Release Notes
Released on 2026-03-12.
Bug fixes
- Fix issue where variables could be inferred as
Divergentif they were assigned using tuple unpacking in loops (#23812) - Allow
error = "all"in a rootpyproject.tomlfile to be overridden usingtool.ty.overridesin a subdirectory'spyproject.tomlfile (#23712) - Only unsoundly upcast
type[]types to their constructorCallabletype during assignability checks, not during redundancy/subtyping checks (#23834, #23901) - Fix stack overflow that could occur with certain recursive protocols (#23870)
LSP server
- Improve syntax highlighting by fixing semantic token classification for generic class members in annotations (#23811)
CLI
- Add
ty explain <RULE>CLI command (#23766)
Core type checking
- Add validation for type parameters with defaults after
TypeVarTupleparameters (#23807) - Allow subtypes of
LiteralStringto be narrowed using equality checks (#23794) - Detect invalid partially stringified PEP-604 unions (#23285)
- Disambiguate duplicate-looking overloaded callables in union display (#23907)
- Don't promote module-literal types to
types.ModuleType(#23786) - Improve type context support for
__setitem__dunder calls (#23800) - Infer
t | {"foo": int}asTDiftis an instance of a TypedDicttdwith afoo: intkey (#23806) - Narrow
TtoT & strrather thanstrifTis a constrained TypeVar withstras one of its constraints (#23850) - Promote
NonetoNone | Unknownin invariant contexts (#23790) - Reject
type[Callable]in type annotations (#23753) - Support enum member access through enum instances and members (#23772)
- Eagerly narrow the type associated with keys of heterogeneous dict literals even when a dict literal appears as a subexpression inside a list or tuple literals (#23569)
- Ensure that
T & ~Sis always inferred as a subtype ofUduring generic inference ifTis understood as a subtype ofU(#23728) - Optimize and improve cycle recovery by preventing "tainted" unions in cycle normalization (#23563)
Installer
- Prefer downloading releases from Astral's mirror over GitHub (#2980)
Contributors
Install ty 0.0.22
Install prebuilt binaries via shell script
curl --proto '=https' --tlsv1.2 -LsSf https://releases.astral.sh/github/ty/releases/download/0.0.22/ty-installer.sh | shInstall prebuilt binaries via powershell script
powershell -ExecutionPolicy Bypass -c "irm https://releases.astral.sh/github/ty/releases/download/0.0.22/ty-installer.ps1 | iex"