dict-typer icon indicating copy to clipboard operation
dict-typer copied to clipboard

Support detecting sequence type from other typed dicts if possible

Open ikornaselur opened this issue 4 years ago • 0 comments

Minimal example:

[{"items": []}, {"items": [1, 2, 3]}]

should produce

from typing import List

class RootTypeItem(TypedDict):
    items: List[int]

RootType = List[RootTypeItem]

but now creates

from typing import List, Union

from typing_extensions import TypedDict


class RootItemType(TypedDict):
    items: Union[List, List[int]]


RootType = List[RootItemType]

ikornaselur avatar Apr 21 '20 11:04 ikornaselur