Problem Statement
Remove null | undefined from a union:
Explanation
NonNullable<T> is a shorthand for excluding null and undefined. It guarantees a defined value.
Code Solution
SolutionRead Only
type MaybeStr = string | null | undefined; type Str = NonNullable<MaybeStr>; // string