Nullable

Syntax

type Nullable<T = unknown>

Represents a type that may be null or undefined.

Example

import { Nullable } from 'potence';

let variable: Nullable<number> = 5;
variable = null;   // no error

Remarks

Since this type equates to T | undefined | null, you may not want to use this type if your code style is adamant about sticking with either undefined or null throughout the code.