Skip to content

Support string annotations in functional class annotations #2528

@charliermarsh

Description

@charliermarsh

E.g., Mypy and Pyright both support this:

from typing import NamedTuple

NT = NamedTuple("NT", [("field", "set[int]")])

NT(1)  # error: Argument 1 to "NT" has incompatible type "int"; expected "set[int]"  [arg-type]

Today, ty errors on "set[int]" with:

Object of type `Literal["set[int]"]` is not valid as a `NamedTuple` field type(invalid-type-form)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions