TypeScript · Middle · Question 24 of 75
What does NonNullable<string | null | undefined> return?
- ✓Correct answer:
string - 2
string | undefined - 3
never
Explanation
NonNullable<T> excludes null and undefined from a union. It's currently implemented as T & {}. Handy for values after a check or in filter results.