mirror of https://github.com/astral-sh/ruff
## Summary Prefer the declared type for collection literals, e.g., ```py x: list[Any] = [1, "2", (3,)] reveal_type(x) # list[Any] ``` This solves a large part of https://github.com/astral-sh/ty/issues/136 for invariant generics, where respecting the declared type is a lot more important. It also means that annotated dict literals with `dict[_, Any]` is a way out of https://github.com/astral-sh/ty/issues/1248. |
||
|---|---|---|
| .. | ||
| annotations.md | ||
| augmented.md | ||
| multi_target.md | ||
| unbound.md | ||
| walrus.md | ||