Release Notes
Released on 2026-04-28.
Notable changes
-
ty now prefers the declared type of an annotated assignment in more situations (#24802).
Consider this example:from some_library import untyped_function threshold: int | None = 0 result: str = untyped_function()
ty previously favored the inferred type of the right hand side expression when
thresholdandresultwere used. This is useful forthreshold, as it allows something likethreshold += 1to work without an error: we know thatthresholdcould later becomeNone, but right now, we see that it is anint. However, forresult, the inferred type isUnknown. This is not a useful type and it can lead to false negatives. Starting with this release, ty will therefore prefer
the declared type if the inferred and declared types are mutually assignable. In the above example,thresholdwill still be inferred asint(or ratherLiteral[1]), butresultwill now be inferred asstr. If you previously addedcasts to work around this behavior, you should be able to remove them after upgrading.
Bug fixes
- Fix reporting of annotation-only locals as unused (#24811)
- Fix project and workspace selection (#24824)
- Fix go-to definition for generic classes (#24714)
- Fix receiver coloring for aliased decorators (#24884)
LSP server
- Add support for go-to definition in literal enum member inlay hints (#24792)
- Add support for "baking" keyword argument inlay hints into the source code (#24667)
- Don't allow inlay hint edits when introducing a non global scope symbol (#24797)
- Omit semantic highlighting for unresolved symbols (#24718)
Core type checking
- Support narrowing with aliased conditional expressions (#24302)
- Model short-circuiting control flow in Boolean expressions (#24458)
- Handle
finallyblocks where alltry/exceptblocks are terminal (#24882) - Detect invalid
ClassVarvs instance-attribute overrides (#24767) - Emit diagnostic for invalid uses of
Unpack[...](#24868) - Infer lambda parameter types with
Callabletype context (#24317) - Support
**unpacking ofTypedDictin dict-literal assignments (#24703) - Support
Unpack[TypedDict]in**kwargssignatures (#24653) - Treat
[*xs]as an irrefutable pattern when matching onSequence(#24787) - Improve generics solving for unions in invariant positions (#24698)
- Improve generics solving for unions when matching against protocols (#24837)
Diagnostics
- Add error context to
invalid-return-typediagnostics,invalid-yielddiagnostics, attribute assignment diagnostics (#24770, #24771) - Add error context for invalid TypedDict assignments (#24790)
- Add error context for invalid intersection type assignments (#24772)
- Improve TypedDict to
dictassignment error diagnostics (#24768) - Add contextual secondary annotations in more places (#24696)
- Include full type in
invalid-keydiagnostics for unions of TypedDicts (#24693) - Emit more specific diagnostics for "possibly unbound" errors from context manager dunder methods invoked on a union. (#24662)
- Remove duplicate
invalid-type-formdiagnostics for PEP-613 type alias values (#24760) - Improve diagnostics for implicit calls to a possibly unbound unary operator (#24816)
- Improve diagnostics for possibly-unbound errors from implicit dunder calls on unions (#24676)
Performance
- Optimize signature checking based on number of arguments (#24674)
- Defer union of parameter types (#24756)
- Skip checks for gradual vararg calls (#24748)
Other changes
- Fix notifications about watched changes for entities outside any workspace (#24775)
Contributors
- @MatthewMckee4
- @lerebear
- @tonyxwz
- @sharkdp
- @felixscherz
- @MichaReiser
- @tamird
- @ibraheemdev
- @AlexWaygood
- @denyszhak
- @charliermarsh
- @mtshiba
- @EliteTK
- @carljm
Install ty 0.0.33
Install prebuilt binaries via shell script
curl --proto '=https' --tlsv1.2 -LsSf https://releases.astral.sh/github/ty/releases/download/0.0.33/ty-installer.sh | shInstall prebuilt binaries via powershell script
powershell -ExecutionPolicy Bypass -c "irm https://releases.astral.sh/github/ty/releases/download/0.0.33/ty-installer.ps1 | iex"Download ty 0.0.33
Verifying GitHub Artifact Attestations
The artifacts in this release have attestations generated with GitHub Artifact Attestations. These can be verified by using the GitHub CLI:
gh attestation verify <file-path of downloaded artifact> --repo astral-sh/tyYou can also download the attestation from GitHub and verify against that directly:
gh attestation verify <file-path of downloaded artifact> --bundle <file-path of downloaded attestation>