-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Closed as not planned
Closed as not planned
Copy link
Description
Bug Report
🔎 Search Terms
- Autocompletion, completions, missing, generics, object, string literals unions, etc.
🕗 Version & Regression Information
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about Generics
⏯ Playground Link
💻 Code
type Test<
T extends {
example: "yes" | "no";
}
> = T["example"];
const foo: Test<{ example: "" }> = "yes";
// ^^ <- No completions available here.
// As a string literal there should be concrete completions for "yes" | "no".
// The compiler does however recognize the correct type with type error:
// `Type '{ example: ""; }' does not satisfy the constraint '{ example: "yes" | "no"; }'.`
🙁 Actual behavior
There are no type completions hints for string literal unions inside generic objects.
🙂 Expected behavior
There should be type completion hints with the appropriate type variants. In the example above, with the completions should be yes
and no
.
Metadata
Metadata
Assignees
Labels
No labels