Skip to content

Incorrect type annotation for Union #276

@hugary1995

Description

@hugary1995

I got something like

Number: typing._UnionGenericAlias  # value = typing.Union[int, float, bool]

where I expect the correct annotation to be either

Number = typing.Union[int, float, bool]

or PEP 613-style:

Number: TypeAlias = int | float | bool

I'm using version 2.5.5.

Please let me know if I was doing something wrong, or point me to the relevant source code so that I can make a PR. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions