Skip to content

expand unions in order to solve generic overloads more precisely #2657

@rouge8

Description

@rouge8

Summary

Apologies I don't quite know how to describe this other than an example:

In https://play.ty.dev/af42dbca-2851-49a9-beb2-4ef0b56c7a1b, ty thinks y is int | None while mypy (correctly) thinks it's int. I think this is related to this mypy PR: python/mypy#15846

ty infers the correct type without the overloads, but mypy does not ☹️ .

Version

ty 0.0.14 (Homebrew 2026-01-27)

Metadata

Metadata

Assignees

No one assigned

    Labels

    genericsBugs or features relating to ty's generics implementationoverloads

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions