Skip to content

Commit 832295d

Browse files
committed
Address CR feedback
1 parent 032cd32 commit 832295d

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/compiler/checker.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7603,10 +7603,12 @@ namespace ts {
76037603
}
76047604
return;
76057605
}
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.
76107612
let matchingTypes: Type[];
76117613
for (const t of (<UnionOrIntersectionType>source).types) {
76127614
if (typeIdenticalToSomeType(t, (<UnionOrIntersectionType>target).types)) {
@@ -7616,8 +7618,7 @@ namespace ts {
76167618
else if (t.flags & (TypeFlags.NumberLiteral | TypeFlags.StringLiteral)) {
76177619
const b = getBaseTypeOfLiteralType(t);
76187620
if (typeIdenticalToSomeType(b, (<UnionOrIntersectionType>target).types)) {
7619-
(matchingTypes || (matchingTypes = [])).push(t);
7620-
matchingTypes.push(b);
7621+
(matchingTypes || (matchingTypes = [])).push(t, b);
76217622
}
76227623
}
76237624
}

0 commit comments

Comments
 (0)