In my quest to filter out specific types from a group, I encountered a challenge with exclusion. Take for instance the scenario below:
type RemoveUndefined<T> = T extends undefined | infer R ? R : T;
type numbersOnly = RemoveUndefined<undefined | number> // undefined | number 🙁
Despite my efforts, it appears that the desired outcome of isolating only the type numbers
has not been achieved. I am left questioning where I may have gone wrong in this process, or whether such exclusion is feasible at all. Any insights would be greatly appreciated.