Summary
Ty returns an unresolved-attribute error on TypedDict classmethods, although they appear to work fine at runtime. It's not really clear to me if they should be allowed at run-time - PEP-589 just says "Methods are not allowed". Classmethods like this are commonly used for alternative constructors (although it generally seems like a dataclass is a better option).
Perhaps ty should allow this? Or return a more explicit error?
Example:
from __future__ import annotations
from typing import TypedDict
class D(TypedDict):
a: int
@classmethod
def c(cls, a: int) -> D:
return cls(a=a)
d = D.c(a=5) # <- Class `D` has no attribute `c` (unresolved-attribute) [Ln 11, Col 5]
print(d.a)
returns
Class `D` has no attribute `c` (unresolved-attribute) [Ln 11, Col 5]
(link https://play.ty.dev/862cf628-892f-43bf-9263-66163f1e84d0)
Version
ty 0.0.8
No response