true
if it is, otherwise false
.
An object in this context is defined as a non-null object (excluding functions and arrays).
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
Checks if a given type
T
qualifies as an object.