|
7 | 7 | CaseClause,
|
8 | 8 | changeExtension,
|
9 | 9 | CharacterCodes,
|
10 |
| - CheckMode, |
11 | 10 | combinePaths,
|
12 | 11 | comparePaths,
|
13 | 12 | comparePatternKeys,
|
@@ -406,7 +405,7 @@ function getStringLiteralCompletionEntries(sourceFile: SourceFile, node: StringL
|
406 | 405 | // Get string literal completions from specialized signatures of the target
|
407 | 406 | // i.e. declare function f(a: 'A');
|
408 | 407 | // f("/*completion position*/")
|
409 |
| - return argumentInfo && (getStringLiteralCompletionsFromSignature(argumentInfo.invocation, node, argumentInfo, typeChecker) || getStringLiteralCompletionsFromSignature(argumentInfo.invocation, node, argumentInfo, typeChecker, CheckMode.Normal)) || fromContextualType(ContextFlags.None); |
| 408 | + return argumentInfo && getStringLiteralCompletionsFromSignature(argumentInfo.invocation, node, argumentInfo, typeChecker) || fromContextualType(ContextFlags.None); |
410 | 409 | }
|
411 | 410 | // falls through (is `require("")` or `require(""` or `import("")`)
|
412 | 411 |
|
@@ -496,11 +495,11 @@ function getAlreadyUsedTypesInStringLiteralUnion(union: UnionTypeNode, current:
|
496 | 495 | return mapDefined(union.types, type => type !== current && isLiteralTypeNode(type) && isStringLiteral(type.literal) ? type.literal.text : undefined);
|
497 | 496 | }
|
498 | 497 |
|
499 |
| -function getStringLiteralCompletionsFromSignature(call: CallLikeExpression, arg: StringLiteralLike, argumentInfo: SignatureHelp.ArgumentInfoForCompletions, checker: TypeChecker, checkMode = CheckMode.IsForStringLiteralArgumentCompletions): StringLiteralCompletionsFromTypes | undefined { |
| 498 | +function getStringLiteralCompletionsFromSignature(call: CallLikeExpression, arg: StringLiteralLike, argumentInfo: SignatureHelp.ArgumentInfoForCompletions, checker: TypeChecker): StringLiteralCompletionsFromTypes | undefined { |
500 | 499 | let isNewIdentifier = false;
|
501 | 500 | const uniques = new Map<string, true>();
|
502 | 501 | const editingArgument = isJsxOpeningLikeElement(call) ? Debug.checkDefined(findAncestor(arg.parent, isJsxAttribute)) : arg;
|
503 |
| - const candidates = checker.getCandidateSignaturesForStringLiteralCompletions(call, editingArgument, checkMode); |
| 502 | + const candidates = checker.getCandidateSignaturesForStringLiteralCompletions(call, editingArgument); |
504 | 503 | const types = flatMap(candidates, candidate => {
|
505 | 504 | if (!signatureHasRestParameter(candidate) && argumentInfo.argumentCount > candidate.parameters.length) return;
|
506 | 505 | let type = candidate.getTypeParameterAtPosition(argumentInfo.argumentIndex);
|
|
0 commit comments