Skip to content

Tuples of unions, Unions of tuples #493

Open
@sharkdp

Description

@sharkdp

An example that I got from this post. As mentioned there, it's probably hard to support this in full generality, but it seems like those base cases should maybe be handled:

from ty_extensions import static_assert, is_equivalent_to, is_assignable_to, is_subtype_of

static_assert(is_equivalent_to(tuple[int | str], tuple[int] | tuple[str]))  # currently fails
static_assert(is_assignable_to(tuple[int | str], tuple[int] | tuple[str]))  # currently fails
static_assert(is_subtype_of(tuple[int | str], tuple[int] | tuple[str]))  # currently fails

https://play.ty.dev/fa049103-bd97-454c-891e-92bda33973a5

Metadata

Metadata

Assignees

No one assigned

    Labels

    type propertiessubtyping, assignability, equivalence, and more

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions