@@ -15500,7 +15500,7 @@ namespace ts {
1550015500 // First, infer between exactly matching source and target constituents and remove
1550115501 // the matching types. Types exactly match when they are identical or, in union
1550215502 // 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 ;
1550415504 const [tempSources, tempTargets] = inferFromMatchingTypes((<UnionOrIntersectionType>source).types, (<UnionOrIntersectionType>target).types, matching);
1550515505 // Next, infer between closely matching source and target constituents and remove
1550615506 // the matching types. Types closely match when they are instantiations of the same
@@ -15515,7 +15515,7 @@ namespace ts {
1551515515 else if (target.flags & TypeFlags.Union && !(target.flags & TypeFlags.EnumLiteral) || target.flags & TypeFlags.Intersection) {
1551615516 // This block of code is an optimized version of the block above for the simpler case
1551715517 // of a singleton source type.
15518- const matching = target.flags & TypeFlags.Union ? isTypeOrBaseExactlyMatchedBy : isTypeExactlyMatchedBy ;
15518+ const matching = target.flags & TypeFlags.Union ? isTypeOrBaseIdenticalTo : isTypeIdenticalTo ;
1551915519 if (inferFromMatchingType(source, (<UnionOrIntersectionType>target).types, matching)) return;
1552015520 if (inferFromMatchingType(source, (<UnionOrIntersectionType>target).types, isTypeCloselyMatchedBy)) return;
1552115521 }
@@ -15974,19 +15974,8 @@ namespace ts {
1597415974 }
1597515975 }
1597615976
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);
1599015979 }
1599115980
1599215981 function isTypeCloselyMatchedBy(s: Type, t: Type) {
0 commit comments