Pyright will only suggest one Literal value for a TypedDict union:
Ideally it'd suggest both a and b.
Code or Screenshots
from __future__ import annotations
from typing import Union
from typing_extensions import Literal, TypedDict
class EventA(TypedDict):
type: Literal["a"]
class EventB(TypedDict):
type: Literal["b"]
Event = Union[EventA, EventB]
event: Event = {"type": ""}
Describe the bug
Pyright will only suggest one
Literal
value for aTypedDict
union:Ideally it'd suggest both
a
andb
.Code or Screenshots
VS Code extension or command-line
pyright language server:
v1.1.384