Type alias IsUnknown<T>

IsUnknown<T>: IfExtends<T, unknown, true, false>

Checks if a given type T is unknown.

Values of type unknown can hold any value, similar to any, but with stricter type safety. Unlike any, you cannot perform operations directly on values of type unknown without type assertion or type narrowing.

Type Parameters

  • T

Returns

true if T is unknown, otherwise false.

Example

type IsUnknownValue = IsUnknown<unknown>; //  true
type IsNotUnknownValue = IsUnknown<string>; // also true

Remarks

If you want unknown to be exact, use IsExactlyUnknown