🤖 Pick PR #54588 (Fixed a regression with string comp...) into release-5.1 (#54635)

Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com>
This commit is contained in:
TypeScript Bot 2023-06-26 16:24:54 -07:00 committed by GitHub
parent 2faa176a2c
commit db3575ab8a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 1 deletions

View File

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

View File

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