Type Alias Nullable<T>

Nullable: { [K in keyof T]: T[K] | null }

A utility type that makes all properties of a given type T nullable.

Type Parameters

  • T

    The type whose properties will be made nullable.

// Given the type:
type User = {
id: number;
name: string;
};

// The Nullable type will transform it to:
type NullableUser = Nullable<User>;
// Resulting in:
{
id: number | null;
name: string | null;
}