Utility type that extends a type to also accept null or undefined.
null
undefined
The base type to make nullable
const name: Nullable<string> = null;const age: Nullable<number> = undefined;const user: Nullable<User> = { id: 1, name: 'Alice' }; Copy
const name: Nullable<string> = null;const age: Nullable<number> = undefined;const user: Nullable<User> = { id: 1, name: 'Alice' };
Utility type that extends a type to also accept
nullorundefined.