-
Notifications
You must be signed in to change notification settings - Fork 13k
Open
Labels
Awaiting More FeedbackThis means we'd like to hear from more people who would be helped by this featureThis means we'd like to hear from more people who would be helped by this featureSuggestionAn idea for TypeScriptAn idea for TypeScript
Description
π Search Terms
generics, inference, union, never
π Version & Regression Information
This is the behavior in every version I tried, and I reviewed the FAQ for entries about union and never.
β― Playground Link
π» Code
const f = <T,>(x: T | string, y: T | number) => y
f('a', 1) satisfies number // T is "a" now
const g = <T extends undefined>(x: T | number) => x
g(1) satisfies number // T is undefined now
π Actual behavior
T
is not never
.
π Expected behavior
T
should be inferred as never
, because it can be anything.
Additional information about the issue
This may be related to #42491.
jakebaileyMartinJohns
Metadata
Metadata
Assignees
Labels
Awaiting More FeedbackThis means we'd like to hear from more people who would be helped by this featureThis means we'd like to hear from more people who would be helped by this featureSuggestionAn idea for TypeScriptAn idea for TypeScript