Attributes of types.SimpleNamespace not resolved (original) (raw)

Summary

Ty can't resolve custom SimpleNamespace attributes. Minimal repro:

from types import SimpleNamespace

sn = SimpleNamespace(a="a")

a = sn.a

Running ty check with no configuration:

error[unresolved-attribute]: Type `SimpleNamespace` has no attribute `a`
 --> test_simplenamespace_ty.py:5:5
  |
3 | sn = SimpleNamespace(a="a")
4 |
5 | a = sn.a
  |     ^^^^
  |
info: rule `unresolved-attribute` is enabled by default

Version

0.0.1-alpha.5 (3b726d8 2025-05-17)