@@ -17850,21 +17850,6 @@ namespace ts {
17850
17850
return getBestChoiceType(type1, type2);
17851
17851
}
17852
17852
17853
- function checkLiteralExpression(node: LiteralExpression | Token<SyntaxKind.TrueKeyword | SyntaxKind.FalseKeyword>): Type {
17854
- switch (node.kind) {
17855
- case SyntaxKind.NoSubstitutionTemplateLiteral:
17856
- case SyntaxKind.StringLiteral:
17857
- return getFreshTypeOfLiteralType(getLiteralType(node.text));
17858
- case SyntaxKind.NumericLiteral:
17859
- checkGrammarNumericLiteral(<NumericLiteral>node);
17860
- return getFreshTypeOfLiteralType(getLiteralType(+node.text));
17861
- case SyntaxKind.TrueKeyword:
17862
- return trueType;
17863
- case SyntaxKind.FalseKeyword:
17864
- return falseType;
17865
- }
17866
- }
17867
-
17868
17853
function checkTemplateExpression(node: TemplateExpression): Type {
17869
17854
// We just want to check each expressions, but we are unconcerned with
17870
17855
// the type of each expression, as any value may be coerced into a string.
@@ -18077,10 +18062,14 @@ namespace ts {
18077
18062
return nullWideningType;
18078
18063
case SyntaxKind.NoSubstitutionTemplateLiteral:
18079
18064
case SyntaxKind.StringLiteral:
18065
+ return getFreshTypeOfLiteralType(getLiteralType((node as LiteralExpression).text));
18080
18066
case SyntaxKind.NumericLiteral:
18067
+ checkGrammarNumericLiteral(node as NumericLiteral);
18068
+ return getFreshTypeOfLiteralType(getLiteralType(+(node as NumericLiteral).text));
18081
18069
case SyntaxKind.TrueKeyword:
18070
+ return trueType;
18082
18071
case SyntaxKind.FalseKeyword:
18083
- return checkLiteralExpression(node as LiteralExpression) ;
18072
+ return falseType ;
18084
18073
case SyntaxKind.TemplateExpression:
18085
18074
return checkTemplateExpression(<TemplateExpression>node);
18086
18075
case SyntaxKind.RegularExpressionLiteral:
0 commit comments