-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: Conditional TypesThe issue relates to conditional typesThe issue relates to conditional typesFix AvailableA PR has been opened for this issueA PR has been opened for this issue
Milestone
Description
Bug Report
🔎 Search Terms
conditional inference, tuple, never
🕗 Version & Regression Information
- This changed between versions 4.2.0-dev.20210112 and 4.2.0-dev.20210113, is present in 4.2.2, and continues to be present in nightly ( 4.3.0-dev.20210306 ). This is probably caused by Better detect when typical nondistributive conditionals need to be deferred... #42248, possibly related to Infer on tuples broken on nightly #42331, but was not fixed by Add missing unwrap call for the inferredExtendsType #42409.
⏯ Playground Link
💻 Code
type Hmm = [0] extends [infer T, any?] ?
[T, [0] extends [T] ? true : false]
: never🙁 Actual behavior
Hmm is evaluated as [0, false]. Somehow T is inferred as 0, but [0] doesn't extend [T]?
🙂 Expected behavior
Hmm should be evaluated as [0, true] as it does in TS 4.1.5 and below.
This behavior was brought up in a Stack Overflow question asking why it happens; not sure if there's any actual use case for this.
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: Conditional TypesThe issue relates to conditional typesThe issue relates to conditional typesFix AvailableA PR has been opened for this issueA PR has been opened for this issue