Skip to content

Commit 2ee2ffb

Browse files
committed
Use object identity check instead of IsTypeIdenticalTo
1 parent 4230270 commit 2ee2ffb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/compiler/checker.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10210,15 +10210,15 @@ namespace ts {
1021010210

1021110211
function getConditionalTypeWorker(root: ConditionalRoot, mapper: TypeMapper | undefined, checkType: Type, extendsType: Type, trueType: Type, falseType: Type) {
1021210212
// Simplifications for types of the form `T extends U ? T : never` and `T extends U ? never : T`.
10213-
if (falseType.flags & TypeFlags.Never && isTypeIdenticalTo(getActualTypeVariable(trueType), getActualTypeVariable(checkType))) {
10213+
if (falseType.flags & TypeFlags.Never && getActualTypeVariable(trueType) === getActualTypeVariable(checkType)) {
1021410214
if (checkType.flags & TypeFlags.Any || isTypeAssignableTo(getRestrictiveInstantiation(checkType), getRestrictiveInstantiation(extendsType))) { // Always true
1021510215
return trueType;
1021610216
}
1021710217
else if (isIntersectionEmpty(checkType, extendsType)) { // Always false
1021810218
return neverType;
1021910219
}
1022010220
}
10221-
else if (trueType.flags & TypeFlags.Never && isTypeIdenticalTo(getActualTypeVariable(falseType), getActualTypeVariable(checkType))) {
10221+
else if (trueType.flags & TypeFlags.Never && getActualTypeVariable(falseType) === getActualTypeVariable(checkType)) {
1022210222
if (!(checkType.flags & TypeFlags.Any) && isTypeAssignableTo(getRestrictiveInstantiation(checkType), getRestrictiveInstantiation(extendsType))) { // Always true
1022310223
return neverType;
1022410224
}

0 commit comments

Comments
 (0)