From d33256cc5aaf5851afea978e9c02fd80d3c079f6 Mon Sep 17 00:00:00 2001 From: Jack Works Date: Fri, 19 Jun 2020 10:49:49 +0800 Subject: [PATCH] chore: save space --- src/compiler/checker.ts | 12 ++++++------ src/compiler/commandLineParser.ts | 2 +- src/compiler/program.ts | 2 +- src/services/codefixes/fixSpelling.ts | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 4b53148cabb..94d511f92b5 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -13245,7 +13245,7 @@ namespace ts { } else { let suggestion: string | undefined; - if (propName !== undefined && (suggestion = getSuggestionForNonexistentProperty(propName as string, objectType, /** isJsxAttr */ false))) { + if (propName !== undefined && (suggestion = getSuggestionForNonexistentProperty(propName as string, objectType, /*isJsxAttr*/ false))) { if (suggestion !== undefined) { error(accessExpression.argumentExpression, Diagnostics.Property_0_does_not_exist_on_type_1_Did_you_mean_2, propName as string, typeToString(objectType), suggestion); } @@ -16319,7 +16319,7 @@ namespace ts { errorNode = prop.valueDeclaration.name; } const propName = symbolToString(prop); - const suggestion = getSuggestionForNonexistentProperty(propName, errorTarget, /** isJsxAttr */ true); + const suggestion = getSuggestionForNonexistentProperty(propName, errorTarget, /*isJsxAttr*/ true); if (suggestion) reportError(Diagnostics.Property_0_does_not_exist_on_type_1_Did_you_mean_2, propName, typeToString(errorTarget), suggestion); else reportError(Diagnostics.Property_0_does_not_exist_on_type_1, propName, typeToString(errorTarget)); } @@ -16335,7 +16335,7 @@ namespace ts { const name = propDeclaration.name!; if (isIdentifier(name)) { - suggestion = getSuggestionForNonexistentProperty(name, errorTarget, /** isJsxAttr */ false); + suggestion = getSuggestionForNonexistentProperty(name, errorTarget, /*isJsxAttr*/ false); } } if (suggestion !== undefined) { @@ -24852,7 +24852,7 @@ namespace ts { relatedInfo = createDiagnosticForNode(propNode, Diagnostics.Did_you_forget_to_use_await); } else { - const suggestion = getSuggestedSymbolForNonexistentProperty(propNode, containingType, /** isJsxAttr */ false); + const suggestion = getSuggestedSymbolForNonexistentProperty(propNode, containingType, /*isJsxAttr*/ false); if (suggestion !== undefined) { const suggestedName = symbolName(suggestion); errorInfo = chainDiagnosticMessages(errorInfo, Diagnostics.Property_0_does_not_exist_on_type_1_Did_you_mean_2, declarationNameToString(propNode), typeToString(containingType), suggestedName); @@ -24892,7 +24892,7 @@ namespace ts { // Sometimes the symbol is found when location is a return type of a function: `typeof x` and `x` is declared in the body of the function // So the table *contains* `x` but `x` isn't actually in scope. // However, resolveNameHelper will continue and call this callback again, so we'll eventually get a correct suggestion. - return symbol || getSpellingSuggestionForName(unescapeLeadingUnderscores(name), arrayFrom(symbols.values()), meaning, /** isJsxAttr */ false); + return symbol || getSpellingSuggestionForName(unescapeLeadingUnderscores(name), arrayFrom(symbols.values()), meaning, /*isJsxAttr*/ false); }); return result; } @@ -24903,7 +24903,7 @@ namespace ts { } function getSuggestedSymbolForNonexistentModule(name: Identifier, targetModule: Symbol): Symbol | undefined { - return targetModule.exports && getSpellingSuggestionForName(idText(name), getExportsOfModuleAsArray(targetModule), SymbolFlags.ModuleMember, /** isJsxAttr */ false); + return targetModule.exports && getSpellingSuggestionForName(idText(name), getExportsOfModuleAsArray(targetModule), SymbolFlags.ModuleMember, /*isJsxAttr*/ false); } function getSuggestionForNonexistentExport(name: Identifier, targetModule: Symbol): string | undefined { diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index ff443300ede..49a455c2db1 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -1194,7 +1194,7 @@ namespace ts { createDiagnostics: (message: DiagnosticMessage, arg0: string, arg1?: string) => Diagnostic, unknownOptionErrorText?: string ) { - const possibleOption = getSpellingSuggestion(unknownOption, diagnostics.optionDeclarations, getOptionName, /** isJsxAttr */ false); + const possibleOption = getSpellingSuggestion(unknownOption, diagnostics.optionDeclarations, getOptionName, /*isJsxAttr*/ false); return possibleOption ? createDiagnostics(diagnostics.unknownDidYouMeanDiagnostic, unknownOptionErrorText || unknownOption, possibleOption.name) : createDiagnostics(diagnostics.unknownOptionDiagnostic, unknownOptionErrorText || unknownOption); diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 37734eb9286..784347c1f07 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -2784,7 +2784,7 @@ namespace ts { } else { const unqualifiedLibName = removeSuffix(removePrefix(libName, "lib."), ".d.ts"); - const suggestion = getSpellingSuggestion(unqualifiedLibName, libs, identity, /** isJsxAttr */ false); + const suggestion = getSpellingSuggestion(unqualifiedLibName, libs, identity, /*isJsxAttr*/ false); const message = suggestion ? Diagnostics.Cannot_find_lib_definition_for_0_Did_you_mean_1 : Diagnostics.Cannot_find_lib_definition_for_0; fileProcessingDiagnostics.add(createFileDiagnostic( file, diff --git a/src/services/codefixes/fixSpelling.ts b/src/services/codefixes/fixSpelling.ts index 0dfd2d84100..e5a04cfa1aa 100644 --- a/src/services/codefixes/fixSpelling.ts +++ b/src/services/codefixes/fixSpelling.ts @@ -51,7 +51,7 @@ namespace ts.codefix { if (parent.flags & NodeFlags.OptionalChain) { containingType = checker.getNonNullableType(containingType); } - suggestedSymbol = checker.getSuggestedSymbolForNonexistentProperty(node, containingType, /** isJsxAttr */ false); + suggestedSymbol = checker.getSuggestedSymbolForNonexistentProperty(node, containingType, /*isJsxAttr*/ false); } else if (isImportSpecifier(parent) && parent.name === node) { Debug.assertNode(node, isIdentifier, "Expected an identifier for spelling (import)");