Skip to content

Guard()<T>

ts
type Guard<T>: (data) => data is T;

A function that returns a type predicate on the argument.

Type Parameters

Type Parameter
T

Parameters

ParameterType
dataunknown

Returns

data is T


OptionalGuard()<T>

ts
type OptionalGuard<T>: (data) => data is T | undefined | OmitProperty;

Special guard to check optional values

Type Parameters

Type Parameter
T

Parameters

ParameterType
dataunknown

Returns

data is T | undefined | OmitProperty


RequiredGuard()<T>

ts
type RequiredGuard<T>: (data) => data is Exclude<T, OmitProperty>;

Type Parameters

Type Parameter
T

Parameters

ParameterType
dataunknown

Returns

data is Exclude<T, OmitProperty>