-
Notifications
You must be signed in to change notification settings - Fork 13k
Open
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
No labels