Skip to content

Commit 1e70bb8

Browse files
TypeScript BotAndarist
TypeScript Bot
andauthored
🤖 Pick PR #53481 (Retry string completions from the i...) into release-5.0 (#53551)
Co-authored-by: Mateusz BurzyÅ„ski <[email protected]>
1 parent 7e093f0 commit 1e70bb8

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

‎src/services/stringCompletions.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ function getStringLiteralCompletionEntries(sourceFile: SourceFile, node: StringL
439439
const literals = contextualTypes.types.filter(literal => !tracker.hasValue(literal.value));
440440
return { kind: StringLiteralCompletionKind.Types, types: literals, isNewIdentifier: false };
441441
default:
442-
return fromContextualType();
442+
return fromContextualType() || fromContextualType(ContextFlags.None);
443443
}
444444

445445
function fromContextualType(contextFlags: ContextFlags = ContextFlags.Completions): StringLiteralCompletionsFromTypes | undefined {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/// <reference path="fourslash.ts" />
2+
3+
//// declare function test<T>(a: {
4+
//// [K in keyof T]: {
5+
//// b?: (keyof T)[];
6+
//// };
7+
//// }): void;
8+
////
9+
//// test({
10+
//// foo: {},
11+
//// bar: {
12+
//// b: ["/*ts*/"],
13+
//// },
14+
//// });
15+
16+
verify.completions({ marker: ["ts"], exact: ["foo", "bar"] });

0 commit comments

Comments
 (0)