Skip to content

Commit 4b5968e

Browse files
committed
Revert change to substitution type simplification
1 parent fb6ae38 commit 4b5968e

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/compiler/checker.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10196,7 +10196,6 @@ namespace ts {
1019610196
function getSimplifiedType(type: Type, writing: boolean): Type {
1019710197
return type.flags & TypeFlags.IndexedAccess ? getSimplifiedIndexedAccessType(<IndexedAccessType>type, writing) :
1019810198
type.flags & TypeFlags.Conditional ? getSimplifiedConditionalType(<ConditionalType>type, writing) :
10199-
type.flags & TypeFlags.Substitution ? writing ? (<SubstitutionType>type).typeVariable : (<SubstitutionType>type).substitute :
1020010199
type;
1020110200
}
1020210201

@@ -12432,6 +12431,12 @@ namespace ts {
1243212431
if (isFreshLiteralType(target)) {
1243312432
target = (<FreshableType>target).regularType;
1243412433
}
12434+
if (source.flags & TypeFlags.Substitution) {
12435+
source = (<SubstitutionType>source).substitute;
12436+
}
12437+
if (target.flags & TypeFlags.Substitution) {
12438+
target = (<SubstitutionType>target).typeVariable;
12439+
}
1243512440
if (source.flags & TypeFlags.Simplifiable) {
1243612441
source = getSimplifiedType(source, /*writing*/ false);
1243712442
}

src/compiler/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3967,7 +3967,7 @@ namespace ts {
39673967
/* @internal */
39683968
ObjectFlagsType = Nullable | Never | Object | Union | Intersection,
39693969
/* @internal */
3970-
Simplifiable = IndexedAccess | Conditional | Substitution,
3970+
Simplifiable = IndexedAccess | Conditional,
39713971
// 'Narrowable' types are types where narrowing actually narrows.
39723972
// This *should* be every type other than null, undefined, void, and never
39733973
Narrowable = Any | Unknown | StructuredOrInstantiable | StringLike | NumberLike | BigIntLike | BooleanLike | ESSymbol | UniqueESSymbol | NonPrimitive,

0 commit comments

Comments
 (0)