You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fromtypingimportTypeVarTuple, UnionimportrandomTs=TypeVarTuple("Ts")
defrandom_item(*items: *Ts) ->Union[*Ts]:
"""Chooses a random input"""returnrandom.choice(items)
reveal_type(random_item(1, "apple", None)) # should be int | str | None
However, Union[*Ts] simplifies to *Ts which is a typing._UnpackGenericAlias.
Activity
AlexWaygood commentedon Aug 5, 2023
Please clarify whether you believe there is a "bug in the specification", a bug in a specific type checker, or a bug in the behaviour at runtime
randolf-scholz commentedon Aug 5, 2023
Nevermind,
pyrightseems to check this with proper configuration. I would suggest appending something like this as example to theTypeVarTuple-PEP.