Closed
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.