Skip to content

Commit 1e896e5

Browse files
Andaristtypescript-bot
authored andcommitted
Cherry-pick PR microsoft#54588 into release-5.1
Component commits: 8e1f8b6 Fixed a regression with string completions not being available directly in arguments typed using rest parameter
1 parent e6ceba0 commit 1e896e5

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/services/stringCompletions.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ function getStringLiteralCompletionEntries(sourceFile: SourceFile, node: StringL
387387
// Get string literal completions from specialized signatures of the target
388388
// i.e. declare function f(a: 'A');
389389
// f("/*completion position*/")
390-
return argumentInfo && getStringLiteralCompletionsFromSignature(argumentInfo.invocation, node, argumentInfo, typeChecker) || fromContextualType();
390+
return argumentInfo && getStringLiteralCompletionsFromSignature(argumentInfo.invocation, node, argumentInfo, typeChecker) || fromContextualType(ContextFlags.None);
391391
}
392392
// falls through (is `require("")` or `require(""` or `import("")`)
393393

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/// <reference path="fourslash.ts" />
2+
// @strict: true
3+
////
4+
//// function fn<T extends ('value1' | 'value2' | 'value3')[]>(...values: T): T { return values; }
5+
////
6+
//// const value1 = fn('/*1*/');
7+
//// const value2 = fn('value1', '/*2*/');
8+
9+
verify.completions({ marker: ["1", "2"], includes: [`value1`, `value2`, `value3`] })

0 commit comments

Comments
 (0)