Type alias IsNotObject<T, $O>

IsNotObject<T, $O>: $SpecialType<T, $MergeOptions<$O, {
    $else: IsNotObject.$<T, $O>;
    $then: $ResolveBranch<T, $O, [$Then]>;
}>>

🎭 predicate

Validate if T is not an object nor object literals.

Note that Function, Array, and tuple are also objects.

Type Parameters

Example

type R = IsNotObject<object> // false
type R = IsNotObject<{}> // false
type R = IsNotObject<{ a: 1 }> // false
type R = IsNotObject<Function> // false

type R = IsNotObject<never> // true
type R = IsNotObject<unknown> // true
type R = IsNotObject<number> // true

type R = IsNotObject<{} | bigint> // boolean

🔢 customize

Filter to ensure T is not an object nor object literals, otherwise returns never.

Example

type R = IsNotObject<{}, { selection: 'filter' }> // never
type R = IsNotObject<{ a: 1 }, { selection: 'filter' }> // never
type R = IsNotObject<Function, { selection: 'filter' }> // never

type R = IsNotObject<never, { selection: 'filter' }> // never
type R = IsNotObject<unknown, { selection: 'filter' }> // unknown

type R = IsNotObject<{} | bigint> // bigint

🔢 customize:

Validate if T is not exactly object.

Example

type R = IsNotObject<object, { exact: true }> // false
type R = IsNotObject<{}, { exact: true }> // true

🔢 customize:

Disable distribution of union types.

type R = IsNotObject<{} | 1> // boolean
type R = IsNotObject<{} | 1, { distributive: false }> // true

🔢 customize

Use unique branch identifiers to allow precise processing of the result.

Example

type R = IsNotObject<{}, $SelectionBranch> // $Else
type R = IsNotObject<string, $SelectionBranch> // $Then

Generated using TypeDoc