UNPKG

shelving

Version:

Toolkit for using data in JavaScript.

28 lines (27 loc) 1.54 kB
import type { AnyCaller } from "./function.js"; /** Function that always returns null. */ export declare function getNull(): null; /** Nullable is the value or `null` */ export type Nullable<T> = T | null; /** Is a value null? */ export declare function isNull(value: unknown): value is null; /** Assert that a value is not null. */ export declare function assertNull<T>(value: Nullable<T>, caller?: AnyCaller): asserts value is T; /** Is a value not null? */ export declare function notNull<T>(value: Nullable<T>): value is T; /** Assert that a value is not null. */ export declare function assertNotNull<T>(value: Nullable<T>, caller?: AnyCaller): asserts value is T; /** Get the not-nullish version of value. */ export declare function requireNotNull<T>(value: Nullable<T>, caller?: AnyCaller): T; /** Nullish is the value or `null` or `undefined` */ export type Nullish<T> = T | null | undefined; /** Is a value nullish? */ export declare function isNullish<T>(value: Nullish<T>): value is null | undefined; /** Assert that a value is not nullish. */ export declare function assertNullish<T>(value: Nullish<T>, caller?: AnyCaller): asserts value is T; /** Is a value not nullish? */ export declare function notNullish<T>(value: Nullish<T>): value is T; /** Assert that a value is not nullish. */ export declare function assertNotNullish<T>(value: Nullish<T>, caller?: AnyCaller): asserts value is T; /** Get the not-nullish version of value. */ export declare function requireNotNullish<T>(value: Nullish<T>, caller?: AnyCaller): T;