Type Alias IsUnknown<T>

IsUnknown<T>: unknown extends T
    ? [T] extends [null]
        ? false
        : true
    : false

Checks if type T is the unknown type.

Type Parameters

  • T

    The type to check if it is the unknown type.

import { assertType, IsUnknown } from "@std/testing/types";

assertType<IsUnknown<unknown>>(true);
assertType<IsUnknown<never>>(false);