mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-05 08:11:30 -06:00
chore: save space
This commit is contained in:
parent
cdd14ccec6
commit
d33256cc5a
@ -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 {
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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)");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user