- when<input, predicate>(predicate): GuardP<input, predicate extends ((value) => value is infer narrowed)
? narrowed
: never> Type Parameters
- input
- predicate extends ((value) => unknown)
Returns GuardP<input, predicate extends ((value) => value is infer narrowed)
? narrowed
: never>
- when<input, narrowed, excluded>(predicate): GuardExcludeP<input, narrowed, excluded>
Parameters
- predicate: ((input) => input is narrowed)
P.when((value) => boolean)
returns a pattern which matches if the predicate returns true for the current input.Read the documentation for
P.when
on GitHub