🤖 Pick PR #53481 (Retry string completions from the i...) into release-5.0 (#53551)

Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com>
This commit is contained in:
TypeScript Bot
2023-03-28 10:02:57 -07:00
committed by GitHub
co-authored by Mateusz Burzyński
parent 7e093f072b
commit 1e70bb8dc4
2 changed files with 17 additions and 1 deletions
+1 -1
View File
@@ -439,7 +439,7 @@ function getStringLiteralCompletionEntries(sourceFile: SourceFile, node: StringL
const literals = contextualTypes.types.filter(literal => !tracker.hasValue(literal.value));
return { kind: StringLiteralCompletionKind.Types, types: literals, isNewIdentifier: false };
default:
return fromContextualType();
return fromContextualType() || fromContextualType(ContextFlags.None);
}
function fromContextualType(contextFlags: ContextFlags = ContextFlags.Completions): StringLiteralCompletionsFromTypes | undefined {
@@ -0,0 +1,16 @@
/// <reference path="fourslash.ts" />
//// declare function test<T>(a: {
//// [K in keyof T]: {
//// b?: (keyof T)[];
//// };
//// }): void;
////
//// test({
//// foo: {},
//// bar: {
//// b: ["/*ts*/"],
//// },
//// });
verify.completions({ marker: ["ts"], exact: ["foo", "bar"] });