microsoft / microsoft/TypeScript
Unexpected distributive behaviour on type alias
Offen
@ahejlsberg arbeitet bereits daran.
Seit 17.11.2025.
Needs Investigation
- Vorherrschende Sprache
- Go
- Sterne
- 111k
- Forks
- 14.3k
- Ø Merge
- 2 T. 4 Std.
- Gemergte PRs (30 T.)
- 132
Beschreibung
🔎 Search Terms
distributive conditional types, naked type parameter, type alias, unions
🕗 Version & Regression Information
- This changed between versions 3.8.3 and 3.9.7.
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about distributive conditional types, naked type parameter, type alias, unions.
⏯ Playground Link
💻 Code
type Value = 1 | 2
type Result = [Value] extends [infer V]
? V extends unknown
? [V, Value]
: never
: never
🙁 Actual behavior
[1, 1] | [2, 2]
🙂 Expected behavior
[1, 1 | 2] | [2, 1 | 2]
Additional information about the issue
It shouldn't work the way it does now, for several reasons:
- Value is not naked type parameter.
- Using brackets, distributive behaviour must be disabled.
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Bewertung
Dieses Issue wurde noch nicht bewertet.