Type alias IsObject<T>

IsObject<T>: And<IfExtends<T, object, true, false>, And<Not<IsFunction<T>>, Not<IsArray<T>>>>

Checks if a given type T qualifies as an object.

Type Parameters

  • T

Returns

true if it is, otherwise false. An object in this context is defined as a non-null object (excluding functions and arrays).

Example

 IsObject<object>; // true
IsObject<{ name: string }>; // true
IsObject<string>; // false
IsObject<Function>; // true, yes, the built-in Function type is an interface with a bunch of methods, so yes it's an object.
// if you want to use the function type use this:
IsObject<UnknownFunction>; // false
// or this
IsObject<AnyFunction>; // false
IsObject<any[]>; // false
IsObject<null>; // false