mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-10 18:04:18 -05:00
Fix duplicate "this" completion (#25900)
This commit is contained in:
@@ -4670,7 +4670,7 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
// Use contextual parameter type if one is available
|
||||
const type = declaration.symbol.escapedName === "this" ? getContextualThisParameterType(func) : getContextuallyTypedParameterType(declaration);
|
||||
const type = declaration.symbol.escapedName === InternalSymbolName.This ? getContextualThisParameterType(func) : getContextuallyTypedParameterType(declaration);
|
||||
if (type) {
|
||||
return addOptionality(type, isOptional);
|
||||
}
|
||||
@@ -7488,7 +7488,7 @@ namespace ts {
|
||||
const resolvedSymbol = resolveName(param, paramSymbol.escapedName, SymbolFlags.Value, undefined, undefined, /*isUse*/ false);
|
||||
paramSymbol = resolvedSymbol!;
|
||||
}
|
||||
if (i === 0 && paramSymbol.escapedName === "this") {
|
||||
if (i === 0 && paramSymbol.escapedName === InternalSymbolName.This) {
|
||||
hasThisParameter = true;
|
||||
thisParameter = param.symbol;
|
||||
}
|
||||
@@ -15373,7 +15373,7 @@ namespace ts {
|
||||
const jsDocFunctionType = <JSDocFunctionType>jsdocType;
|
||||
if (jsDocFunctionType.parameters.length > 0 &&
|
||||
jsDocFunctionType.parameters[0].name &&
|
||||
(jsDocFunctionType.parameters[0].name as Identifier).escapedText === "this") {
|
||||
(jsDocFunctionType.parameters[0].name as Identifier).escapedText === InternalSymbolName.This) {
|
||||
return getTypeFromTypeNode(jsDocFunctionType.parameters[0].type!);
|
||||
}
|
||||
}
|
||||
@@ -26797,6 +26797,7 @@ namespace ts {
|
||||
|
||||
populateSymbols();
|
||||
|
||||
symbols.delete(InternalSymbolName.This); // Not a symbol, a keyword
|
||||
return symbolsToArray(symbols);
|
||||
|
||||
function populateSymbols() {
|
||||
|
||||
@@ -3559,6 +3559,7 @@ namespace ts {
|
||||
Resolving = "__resolving__", // Indicator symbol used to mark partially resolved type aliases
|
||||
ExportEquals = "export=", // Export assignment symbol
|
||||
Default = "default", // Default export symbol (technically not wholly internal, but included here for usability)
|
||||
This = "this",
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user