IsUnknown

import { IsUnknown } from "jsr:@ende/testing/types";

type alias

type IsUnknown<T> = unknown extends T ? ([T] extends [null] ? false : true) : false

Checks if type T is the unknown type.

Example: Usage

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

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

Source