Skip to content

Commit 7332390

Browse files
committed
Readopt older candidateType check, even though it shouldnt really matter
1 parent 7e856b2 commit 7332390

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/compiler/checker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20424,7 +20424,7 @@ namespace ts {
2042420424
// this a literal context for literals of that primitive type. For example, given a
2042520425
// type parameter 'T extends string', infer string literal types for T.
2042620426
const constraint = getBaseConstraintOfType(contextualType) || emptyObjectType;
20427-
return constraint === keyofConstraintType ||
20427+
return constraint === keyofConstraintType && maybeTypeOfKind(candidateType, TypeFlags.StringLiteral | TypeFlags.NumberLiteral | TypeFlags.UniqueESSymbol) ||
2042820428
constraint.flags & TypeFlags.String && maybeTypeOfKind(candidateType, TypeFlags.StringLiteral) ||
2042920429
constraint.flags & TypeFlags.Number && maybeTypeOfKind(candidateType, TypeFlags.NumberLiteral) ||
2043020430
constraint.flags & TypeFlags.Boolean && maybeTypeOfKind(candidateType, TypeFlags.BooleanLiteral) ||

0 commit comments

Comments
 (0)