Skip to main content

Nullable

A type that allows null in addition to the given generic type.


Interface

typescript
type Nullable<T> = T | null;

Usage

typescript
import { Nullable } from '@modern-kit/types';

type Test = Nullable<string>; // string | null

const test: Nullable<string> = 'test';
const test2: Nullable<string> = null;