P.when((value) => boolean) returns a pattern which matches if the predicate returns true for the current input.
P.when((value) => boolean)
Read the documentation for P.when on GitHub
P.when
match<{ age: number }>(value) .with({ age: P.when(age => age > 21) }, (x) => 'will match if value.age > 21' ) Copy
match<{ age: number }>(value) .with({ age: P.when(age => age > 21) }, (x) => 'will match if value.age > 21' )
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