We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"intellisense template literal", "intellisense property union"
No response
I didn't include a playground link since it's an intellisense issue.
type A = { id: `A:${string}`; a: number; }; type B = { id: `B:${string}`; b: number; }; function foo<T extends A | B>(item: T): void {} foo({ id: "B:" /* auto-complete here */ });
When you trigger intellisense, it suggests all the property names of the union, even if it could already narrow it based on what you've typed so far:
If id is a literal rather than a template literal type, the suggestions are properly narrowed.
id
I think the property suggestions should be limited to the narrowed type, similar to if the discriminant is an ordinary string literal.
The text was updated successfully, but these errors were encountered:
isTypeInvalidDueToUnionDiscriminant
Successfully merging a pull request may close this issue.
π Search Terms
"intellisense template literal", "intellisense property union"
π Version & Regression Information
β― Playground Link
No response
π» Code
I didn't include a playground link since it's an intellisense issue.
π Actual behavior
When you trigger intellisense, it suggests all the property names of the union, even if it could already narrow it based on what you've typed so far:
If
id
is a literal rather than a template literal type, the suggestions are properly narrowed.π Expected behavior
I think the property suggestions should be limited to the narrowed type, similar to if the discriminant is an ordinary string literal.
Additional information about the issue
No response
The text was updated successfully, but these errors were encountered: