From 934da9fb39d36a4afa0121468847c88457fcfe1e Mon Sep 17 00:00:00 2001 From: Andy Date: Mon, 28 Aug 2017 15:03:34 -0700 Subject: [PATCH] Remove template strings in checker.ts (#18016) * Remove template strings in checker.ts * Inline function --- src/compiler/checker.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index bebd354d255..49b6e47d99d 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -3086,7 +3086,7 @@ namespace ts { } function literalTypeToString(type: LiteralType) { - return type.flags & TypeFlags.StringLiteral ? `"${escapeString((type).value)}"` : "" + (type).value; + return type.flags & TypeFlags.StringLiteral ? '"' + escapeString((type).value) + '"' : "" + (type).value; } function getNameOfSymbol(symbol: Symbol): string { @@ -6263,7 +6263,7 @@ namespace ts { if (isExternalModuleNameRelative(moduleName)) { return undefined; } - const symbol = getSymbol(globals, `"${moduleName}"` as __String, SymbolFlags.ValueModule); + const symbol = getSymbol(globals, '"' + moduleName + '"' as __String, SymbolFlags.ValueModule); // merged symbol is module declaration symbol combined with all augmentations return symbol && withAugmentations ? getMergedSymbol(symbol) : symbol; } @@ -15862,7 +15862,7 @@ namespace ts { min = Math.min(min, getMinTypeArgumentCount(sig.typeParameters)); max = Math.max(max, length(sig.typeParameters)); } - const paramCount = min < max ? `${min}-${max}` : min; + const paramCount = min < max ? min + "-" + max : min; diagnostics.add(createDiagnosticForNode(node, Diagnostics.Expected_0_type_arguments_but_got_1, paramCount, typeArguments.length)); } else if (args) { @@ -15875,7 +15875,7 @@ namespace ts { const hasRestParameter = some(signatures, sig => sig.hasRestParameter); const hasSpreadArgument = getSpreadArgumentIndex(args) > -1; const paramCount = hasRestParameter ? min : - min < max ? `${min}-${max}` : + min < max ? min + "-" + max : min; const argCount = args.length - (hasSpreadArgument ? 1 : 0); const error = hasRestParameter && hasSpreadArgument ? Diagnostics.Expected_at_least_0_arguments_but_got_a_minimum_of_1 : @@ -25089,7 +25089,7 @@ namespace ts { } if (diagnosticMessage) { const withMinus = isPrefixUnaryExpression(node.parent) && node.parent.operator === SyntaxKind.MinusToken; - const literal = `${withMinus ? "-" : ""}0o${node.text}`; + const literal = (withMinus ? "-" : "") + "0o" + node.text; return grammarErrorOnNode(withMinus ? node.parent : node, diagnosticMessage, literal); } }