Is there a way to determine if a type is nullable and if it has a conditional type on the value?
I attempted to do so with the following code:
type IsNullable<T> = T extends null ? true : false;
However, I encountered some issues:
type test = IsNullable<number> // Returns false as expected
type test = IsNullable<number | null> // Returns false instead of true
What is the correct method for checking if a type is nullable? I also experimented with T extends null | T
without success.