Type Alias IsNotNull<T, $O>

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

🎭 predicate

Validate if T is not null.

type R = IsNotNull<null> // false

type R = IsNotNull<never> // true
type R = IsNotNull<unknown> // true
type R = IsNotNull<string | boolean> // true

🔢 customize

Filter to ensure T is not null, otherwise returns never.

Type Parameters

type R = IsNotNull<null, { selection: 'filter' }> // never

type R = IsNotNull<never, { selection: 'filter' }> // never
type R = IsNotNull<unknown, { selection: 'filter' }> // unknown
type R = IsNotNull<string | boolean, { selection: 'filter' }> // string | boolean

🔢 customize

Disable distribution of union types.

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

🔢 customize

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

type R = IsNotNull<string, $SelectionBranch> // $Then
type R = IsNotNull<null, $SelectionBranch> // $Else