ts-type-forge
    Preparing search index...

    Type Alias IsUnknown<T>

    IsUnknown: IsAny<T> extends true ? false : unknown extends T ? true : false

    Checks if a given type T is exactly the unknown type.

    unknown extends T holds only for T = unknown or T = any, so any is excluded first via IsAny. The check does not distribute over unions (the checked type appears on the right-hand side of extends).

    Type Parameters

    • T

      The type to check.

    true if T is unknown, false otherwise.

    type T1 = IsUnknown<unknown>; // true
    type T2 = IsUnknown<any>; // false
    type T3 = IsUnknown<never>; // false
    type T4 = IsUnknown<string>; // false
    type T5 = IsUnknown<string | unknown>; // true (`unknown` absorbs the union)