@@ -15500,7 +15500,7 @@ namespace ts {
15500
15500
// First, infer between exactly matching source and target constituents and remove
15501
15501
// the matching types. Types exactly match when they are identical or, in union
15502
15502
// types, when the source is a literal and the target is the corresponding primitive.
15503
- const matching = target.flags & TypeFlags.Union ? isTypeOrBaseExactlyMatchedBy : isTypeExactlyMatchedBy ;
15503
+ const matching = target.flags & TypeFlags.Union ? isTypeOrBaseIdenticalTo : isTypeIdenticalTo ;
15504
15504
const [tempSources, tempTargets] = inferFromMatchingTypes((<UnionOrIntersectionType>source).types, (<UnionOrIntersectionType>target).types, matching);
15505
15505
// Next, infer between closely matching source and target constituents and remove
15506
15506
// the matching types. Types closely match when they are instantiations of the same
@@ -15515,7 +15515,7 @@ namespace ts {
15515
15515
else if (target.flags & TypeFlags.Union && !(target.flags & TypeFlags.EnumLiteral) || target.flags & TypeFlags.Intersection) {
15516
15516
// This block of code is an optimized version of the block above for the simpler case
15517
15517
// of a singleton source type.
15518
- const matching = target.flags & TypeFlags.Union ? isTypeOrBaseExactlyMatchedBy : isTypeExactlyMatchedBy ;
15518
+ const matching = target.flags & TypeFlags.Union ? isTypeOrBaseIdenticalTo : isTypeIdenticalTo ;
15519
15519
if (inferFromMatchingType(source, (<UnionOrIntersectionType>target).types, matching)) return;
15520
15520
if (inferFromMatchingType(source, (<UnionOrIntersectionType>target).types, isTypeCloselyMatchedBy)) return;
15521
15521
}
@@ -15974,19 +15974,8 @@ namespace ts {
15974
15974
}
15975
15975
}
15976
15976
15977
- function isNonObjectOrAnonymousType(type: Type) {
15978
- // We exclude non-anonymous object types because some frameworks (e.g. Ember) rely on the ability to
15979
- // infer between types that don't witness their type variables. Such types would otherwise be eliminated
15980
- // because they appear identical.
15981
- return !(type.flags & TypeFlags.Object) || !!(getObjectFlags(type) & ObjectFlags.Anonymous);
15982
- }
15983
-
15984
- function isTypeExactlyMatchedBy(s: Type, t: Type) {
15985
- return s === t || isNonObjectOrAnonymousType(s) && isNonObjectOrAnonymousType(t) && isTypeIdenticalTo(s, t);
15986
- }
15987
-
15988
- function isTypeOrBaseExactlyMatchedBy(s: Type, t: Type) {
15989
- return isTypeExactlyMatchedBy(s, t) || !!(s.flags & (TypeFlags.StringLiteral | TypeFlags.NumberLiteral)) && isTypeIdenticalTo(getBaseTypeOfLiteralType(s), t);
15977
+ function isTypeOrBaseIdenticalTo(s: Type, t: Type) {
15978
+ return isTypeIdenticalTo(s, t) || !!(s.flags & (TypeFlags.StringLiteral | TypeFlags.NumberLiteral)) && isTypeIdenticalTo(getBaseTypeOfLiteralType(s), t);
15990
15979
}
15991
15980
15992
15981
function isTypeCloselyMatchedBy(s: Type, t: Type) {
0 commit comments