mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-15 12:51:30 -05:00
Unwrap substitutions on conditional check types before comparing them (#43888)
This commit is contained in:
@@ -15022,7 +15022,7 @@ namespace ts {
|
||||
// purposes of resolution. This means such types aren't subject to the instatiation depth limiter.
|
||||
while (true) {
|
||||
const isUnwrapped = isTypicalNondistributiveConditional(root);
|
||||
const checkType = instantiateType(unwrapNondistributiveConditionalTuple(root, root.checkType), mapper);
|
||||
const checkType = instantiateType(unwrapNondistributiveConditionalTuple(root, getActualTypeVariable(root.checkType)), mapper);
|
||||
const checkTypeInstantiable = isGenericObjectType(checkType) || isGenericIndexType(checkType);
|
||||
const extendsType = instantiateType(unwrapNondistributiveConditionalTuple(root, root.extendsType), mapper);
|
||||
if (checkType === wildcardType || extendsType === wildcardType) {
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
//// [curiousNestedConditionalEvaluationResult.ts]
|
||||
// regression test for #43123
|
||||
type Hmm = [0] extends [infer T, any?] ?
|
||||
[T, [0] extends [T] ? true : false]
|
||||
: never
|
||||
|
||||
//// [curiousNestedConditionalEvaluationResult.js]
|
||||
@@ -0,0 +1,11 @@
|
||||
=== tests/cases/compiler/curiousNestedConditionalEvaluationResult.ts ===
|
||||
// regression test for #43123
|
||||
type Hmm = [0] extends [infer T, any?] ?
|
||||
>Hmm : Symbol(Hmm, Decl(curiousNestedConditionalEvaluationResult.ts, 0, 0))
|
||||
>T : Symbol(T, Decl(curiousNestedConditionalEvaluationResult.ts, 1, 29))
|
||||
|
||||
[T, [0] extends [T] ? true : false]
|
||||
>T : Symbol(T, Decl(curiousNestedConditionalEvaluationResult.ts, 1, 29))
|
||||
>T : Symbol(T, Decl(curiousNestedConditionalEvaluationResult.ts, 1, 29))
|
||||
|
||||
: never
|
||||
@@ -0,0 +1,10 @@
|
||||
=== tests/cases/compiler/curiousNestedConditionalEvaluationResult.ts ===
|
||||
// regression test for #43123
|
||||
type Hmm = [0] extends [infer T, any?] ?
|
||||
>Hmm : [0, true]
|
||||
|
||||
[T, [0] extends [T] ? true : false]
|
||||
>true : true
|
||||
>false : false
|
||||
|
||||
: never
|
||||
@@ -0,0 +1,4 @@
|
||||
// regression test for #43123
|
||||
type Hmm = [0] extends [infer T, any?] ?
|
||||
[T, [0] extends [T] ? true : false]
|
||||
: never
|
||||
Reference in New Issue
Block a user