ruff/crates/ty
David Peter 4c889d5251
[ty] Support `typing.TypeAliasType` (#18156)
## Summary

Support direct uses of `typing.TypeAliasType`, as in:

```py
from typing import TypeAliasType

IntOrStr = TypeAliasType("IntOrStr", int | str)

def f(x: IntOrStr) -> None:
    reveal_type(x)  # revealed: int | str
```

closes https://github.com/astral-sh/ty/issues/392

## Ecosystem

The new false positive here:
```diff
+ error[invalid-type-form] altair/utils/core.py:49:53: The first argument to `Callable` must be either a list of types, ParamSpec, Concatenate, or `...`
```
comes from the fact that we infer the second argument as a type
expression now. We silence false positives for PEP695 `ParamSpec`s, but
not for `P = ParamSpec("P")` inside `Callable[P, ...]`.

## Test Plan

New Markdown tests
2025-05-19 16:36:49 +02:00
..
docs [ty] Support `typing.TypeAliasType` (#18156) 2025-05-19 16:36:49 +02:00
src Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
tests Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
CONTRIBUTING.md [ty] contribution guide (#18061) 2025-05-13 10:55:01 +02:00
Cargo.toml [ty] Enable 'ansi' feature to fix compile error (#18116) 2025-05-15 11:43:15 +02:00
README.md [ty] contribution guide (#18061) 2025-05-13 10:55:01 +02:00
build.rs Parse `dist-workspace.toml` for version (#17868) 2025-05-06 12:18:17 +00:00

README.md

ty

ty is an extremely fast type checker. Currently, it is a work-in-progress and not ready for production use.

The Rust code for ty lives in this repository; see CONTRIBUTING.md for more information on contributing to ty.

See the ty repo for ty documentation and releases.