@@ -7603,10 +7603,12 @@ namespace ts {
7603
7603
}
7604
7604
return;
7605
7605
}
7606
- // Find each target constituent type that has an identically matching source
7607
- // constituent type, and for each such target constituent type infer from the type to
7608
- // itself. When inferring from a type to itself we effectively find all type parameter
7609
- // occurrences within that type and infer themselves as their type arguments.
7606
+ // Find each source constituent type that has an identically matching target constituent
7607
+ // type, and for each such type infer from the type to itself. When inferring from a
7608
+ // type to itself we effectively find all type parameter occurrences within that type
7609
+ // and infer themselves as their type arguments. We have special handling for numeric
7610
+ // and string literals because the number and string types are not represented as unions
7611
+ // of all their possible values.
7610
7612
let matchingTypes: Type[];
7611
7613
for (const t of (<UnionOrIntersectionType>source).types) {
7612
7614
if (typeIdenticalToSomeType(t, (<UnionOrIntersectionType>target).types)) {
@@ -7616,8 +7618,7 @@ namespace ts {
7616
7618
else if (t.flags & (TypeFlags.NumberLiteral | TypeFlags.StringLiteral)) {
7617
7619
const b = getBaseTypeOfLiteralType(t);
7618
7620
if (typeIdenticalToSomeType(b, (<UnionOrIntersectionType>target).types)) {
7619
- (matchingTypes || (matchingTypes = [])).push(t);
7620
- matchingTypes.push(b);
7621
+ (matchingTypes || (matchingTypes = [])).push(t, b);
7621
7622
}
7622
7623
}
7623
7624
}
0 commit comments