Interface: Predicate()\<T, U\>
A callable predicate with fluent composition methods.
T is the accepted input type. U is the type established when the predicate returns true.
Type Parameters
Section titled “Type Parameters”T
U extends T = T
Predicate(
value):value is U
A callable predicate with fluent composition methods.
T is the accepted input type. U is the type established when the predicate returns true.
Parameters
Section titled “Parameters”T
Returns
Section titled “Returns”value is U
Methods
Section titled “Methods”and<
P>(…predicates):Predicate<T,Extract<U&AndNarrowed<U,P,U>,T>>
Returns a predicate requiring this predicate and every supplied predicate to match.
Type guards are intersected. Additional predicates are checked against the type already established by this predicate.
Type Parameters
Section titled “Type Parameters”P extends readonly PredicateInput<U>[]
Parameters
Section titled “Parameters”predicates
Section titled “predicates”…P
Returns
Section titled “Returns”Predicate<T, Extract<U & AndNarrowed<U, P, U>, T>>
negate()
Section titled “negate()”negate():
Predicate<T,Exclude<T,U>>
Returns the logical inverse of this predicate.
For a type predicate narrowing T to U, the result narrows to Exclude<T, U>.
Returns
Section titled “Returns”Predicate<T, Exclude<T, U>>
or<
P>(…predicates):Predicate<T,Extract<U,T> |Extract<OrNarrowed<U,P,never>,T>>
Returns a predicate requiring this predicate or any supplied predicate to match.
Type guards are unioned. Because an ordinary boolean predicate could
accept any value of U, including one causes the resulting predicate to
narrow only to U.
Type Parameters
Section titled “Type Parameters”P extends readonly PredicateInput<U>[]
Parameters
Section titled “Parameters”predicates
Section titled “predicates”…P
Returns
Section titled “Returns”Predicate<T, Extract<U, T> | Extract<OrNarrowed<U, P, never>, T>>