Skip to content

Latest commit

 

History

History
43 lines (31 loc) · 588 Bytes

File metadata and controls

43 lines (31 loc) · 588 Bytes

typelab / assertions / IsUnknown

type IsUnknown<T> = IsAny<T> extends true ? false : [unknown] extends [T] ? true : false;

Checks if a given type T is an unknown type.

Type Parameters

Type Parameter Description

T

The type to be checked.

Returns

true if T is an unknown type, false otherwise.

Example

type Valid = IsUnknown<unknown>; // true
type Invalid = IsUnknown<string>; // false