Use Cases
from typing import TypedDict, Literal, TypeAlias
class Foo(TypedDict):
kind: Literal["foo"]
foo_value: int
class Bar(TypedDict):
kind: Literal["bar"]
bar_value: str
type FooBar = Foo | Bar
case 1
item: FooBar = {
"kind": "|",
}
expected completion: 'foo' | 'bar'
case 2
item: FooBar = {
"kind": "foo",
"|"
}
expected completion: 'foo_value'
Use Cases
case 1
expected completion:
'foo' | 'bar'case 2
expected completion:
'foo_value'