Skip to content

Latest commit

 

History

History
49 lines (35 loc) · 543 Bytes

File metadata and controls

49 lines (35 loc) · 543 Bytes

typelab / aliases / Nullable

type Nullable<T> = T | null;

Type that allows a value to be T or null.

Type Parameters

Type Parameter Default type Description

T

never

The original type.

Returns

Union T and null

Example

const example: Nullable<string> = null; // valid
const example2: Nullable<string> = undefined; // invalid