Intellisense doesn't narrow properly when discriminator is a template literal #61347
Labels
Help Wanted
You can do this
Possible Improvement
The current behavior isn't wrong, but it's possible to see that it might be better in some cases
Milestone
π 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: