Skip to content

Commit 8fd1308

Browse files
authored
Cover more literal expressions in getQuickTypeOfExpression (#52181)
1 parent d0938c8 commit 8fd1308

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/compiler/checker.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,7 @@ import {
451451
isBlock,
452452
isBlockOrCatchScoped,
453453
isBlockScopedContainerTopLevel,
454+
isBooleanLiteral,
454455
isCallChain,
455456
isCallExpression,
456457
isCallLikeExpression,
@@ -599,6 +600,7 @@ import {
599600
isLet,
600601
isLineBreak,
601602
isLiteralComputedPropertyDeclarationName,
603+
isLiteralExpression,
602604
isLiteralExpressionOfObject,
603605
isLiteralImportTypeNode,
604606
isLiteralTypeNode,
@@ -37189,8 +37191,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
3718937191
else if (isAssertionExpression(expr) && !isConstTypeReference(expr.type)) {
3719037192
return getTypeFromTypeNode((expr as TypeAssertion).type);
3719137193
}
37192-
else if (node.kind === SyntaxKind.NumericLiteral || node.kind === SyntaxKind.StringLiteral ||
37193-
node.kind === SyntaxKind.TrueKeyword || node.kind === SyntaxKind.FalseKeyword) {
37194+
else if (isLiteralExpression(node) || isBooleanLiteral(node)) {
3719437195
return checkExpression(node);
3719537196
}
3719637197
return undefined;

0 commit comments

Comments
 (0)