@pengzhanbo/utils - v3.7.3
    Preparing search index...

    Type Alias IsNullable<T>

    IsNullable: IsAny<T> extends true
        ? true
        : Extract<T, null> extends never ? false : true

    If the type T is a union type containing null (i.e. T is nullable), output type true, otherwise output type false.

    如果类型 T 是包含类型 null 的联合类型(即 T 可为空),则输出 true,否则输出 false。

    Type Parameters

    • T
    type A = IsNullable<string>;
    //=> false

    type B = IsNullable<string | null>;
    //=> true