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

    Type Alias IsNullable<T>

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

    If the type T accepts type null, output type true, otherwise output type false.

    如果类型 T 包含类型 null,则输出 true,否则输出 false。

    Type Parameters

    • T

      要检查的类型

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

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