type IsOptional<T,True,False>
Determines whether the given type T
is optional, that is, whether it can be null or undefined.
Definition
type IsOptional<T, True = true, False = false> = undefined extends T ? True : null extends T ? True : False;