Skip to content

[red-knot] Implicit type aliases in typeshed are widened as Unknown | T #17032

@cake-monotone

Description

@cake-monotone

Some implicit type aliases in typeshed are not annotated using TypeAlias, such as:

# types.pyi
LambdaType = FunctionType
NotImplementedType = _NotImplementedType
# ctypes/wintypes.pyi
BYTE = c_byte
WORD = c_ushort
...
BOOLEAN = BYTE

Since these aliases lack explicit type annotations, Red-knot currently widens them as Unknown | T:

from types import LambdaType

reveal_type(LambdaType)  # revealed: Unknown | Literal[FunctionType]

Metadata

Metadata

Assignees

No one assigned

    Labels

    tyMulti-file analysis & type inference

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions