Skip to content

Commit acd3fec

Browse files
committed
Include isNeverLikeIntersection check in getNormalizedType
1 parent 346ec30 commit acd3fec

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

src/compiler/checker.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14812,6 +14812,7 @@ namespace ts {
1481214812
function getNormalizedType(type: Type, writing: boolean): Type {
1481314813
return isFreshLiteralType(type) ? (<FreshableType>type).regularType :
1481414814
getObjectFlags(type) & ObjectFlags.Reference && (<TypeReference>type).node ? createTypeReference((<TypeReference>type).target, getTypeArguments(<TypeReference>type)) :
14815+
type.flags & TypeFlags.Intersection && isNeverLikeIntersection(<IntersectionType>type) ? neverType :
1481514816
type.flags & TypeFlags.Substitution ? writing ? (<SubstitutionType>type).typeVariable : (<SubstitutionType>type).substitute :
1481614817
type.flags & TypeFlags.Simplifiable ? getSimplifiedType(type, writing) :
1481714818
type;
@@ -15203,9 +15204,6 @@ namespace ts {
1520315204
result = typeRelatedToSomeType(getRegularTypeOfObjectLiteral(source), <UnionType>target, reportErrors && !(source.flags & TypeFlags.Primitive) && !(target.flags & TypeFlags.Primitive));
1520415205
}
1520515206
else if (target.flags & TypeFlags.Intersection) {
15206-
if (isNeverLikeIntersection(<IntersectionType>target)) {
15207-
return Ternary.False;
15208-
}
1520915207
result = typeRelatedToEachType(getRegularTypeOfObjectLiteral(source), target as IntersectionType, reportErrors, IntersectionState.Target);
1521015208
if (result && (isPerformingExcessPropertyChecks || isPerformingCommonPropertyChecks)) {
1521115209
// Validate against excess props using the original `source`
@@ -15215,9 +15213,6 @@ namespace ts {
1521515213
}
1521615214
}
1521715215
else if (source.flags & TypeFlags.Intersection) {
15218-
if (isNeverLikeIntersection(<IntersectionType>source)) {
15219-
return Ternary.True;
15220-
}
1522115216
// Check to see if any constituents of the intersection are immediately related to the target.
1522215217
//
1522315218
// Don't report errors though. Checking whether a constituent is related to the source is not actually

0 commit comments

Comments
 (0)