-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Open
Labels
Experience EnhancementNoncontroversial enhancementsNoncontroversial enhancementsSuggestionAn idea for TypeScriptAn idea for TypeScript
Milestone
Description
π Search Terms
no infer discriminate union
π Version & Regression Information
Tested on version 5.6.3
β― Playground Link
π» Code
interface A {
type: 'a',
value: string;
}
interface B {
type: 'b',
size: number;
}
type Union = A | B;
function accept<T extends Union>(union: NoInfer<T>) {
}
accept({type: 'a'})π Actual behavior
When trying to autocomplete after writing type a the autocomplete doesn't work (but the result does get type checked):

π Expected behavior
Even with NoInfer it should autocomplete the other properties of the "inferred" discriminate union case as it correctly type checks it if written wrong.
Additional information about the issue
No response
Metadata
Metadata
Assignees
Labels
Experience EnhancementNoncontroversial enhancementsNoncontroversial enhancementsSuggestionAn idea for TypeScriptAn idea for TypeScript