Skip to content

Latest commit

 

History

History
42 lines (30 loc) · 511 Bytes

File metadata and controls

42 lines (30 loc) · 511 Bytes

typelab / utils / ExcludeNullish

type ExcludeNullish<T> = Exclude<T, null | undefined>;

Exclude null and undefined from type T.

Type Parameters

Type Parameter Description

T

The original type.

Returns

T without null and `undefined.

Example

type NonNullishType = ExcludeNullish<string | null | undefined>; // string