mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-17 01:49:57 -05:00
Support completions for string literal in rest parameter
This commit is contained in:
@@ -84,6 +84,7 @@ namespace ts {
|
||||
getIndexTypeOfType,
|
||||
getBaseTypes,
|
||||
getTypeFromTypeNode,
|
||||
getParameterType: getTypeAtPosition,
|
||||
getReturnTypeOfSignature,
|
||||
getNonNullableType,
|
||||
getSymbolsInScope,
|
||||
|
||||
@@ -2341,6 +2341,11 @@ namespace ts {
|
||||
getIndexTypeOfType(type: Type, kind: IndexKind): Type;
|
||||
getBaseTypes(type: InterfaceType): ObjectType[];
|
||||
getReturnTypeOfSignature(signature: Signature): Type;
|
||||
/**
|
||||
* Gets the type of a parameter at a given position in a signature.
|
||||
* Returns `any` if the index is not valid.
|
||||
*/
|
||||
/* @internal */ getParameterType(signature: Signature, parameterIndex: number): Type;
|
||||
getNonNullableType(type: Type): Type;
|
||||
|
||||
getSymbolsInScope(location: Node, meaning: SymbolFlags): Symbol[];
|
||||
|
||||
@@ -204,10 +204,7 @@ namespace ts.Completions {
|
||||
typeChecker.getResolvedSignature(argumentInfo.invocation, candidates);
|
||||
|
||||
for (const candidate of candidates) {
|
||||
if (candidate.parameters.length > argumentInfo.argumentIndex) {
|
||||
const parameter = candidate.parameters[argumentInfo.argumentIndex];
|
||||
addStringLiteralCompletionsFromType(typeChecker.getTypeAtLocation(parameter.valueDeclaration), entries);
|
||||
}
|
||||
addStringLiteralCompletionsFromType(typeChecker.getParameterType(candidate, argumentInfo.argumentIndex), entries);
|
||||
}
|
||||
|
||||
if (entries.length) {
|
||||
|
||||
Reference in New Issue
Block a user