Skip to content

Commit

Permalink
🤖 Pick PR #53481 (Retry string completions from the i...) into releas…
Browse files Browse the repository at this point in the history
…e-5.0 (#53551)

Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com>
  • Loading branch information
TypeScript Bot and Andarist authored Mar 28, 2023
1 parent 7e093f0 commit 1e70bb8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/services/stringCompletions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
@@ -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"] });

0 comments on commit 1e70bb8

Please sign in to comment.