Skip to content

when

when<T, V>(predicate, then, description?): MatchCase<T>

Defined in: extract/spec.ts:523

Create a match case with a predicate and result spec.

T extends Spec

V = unknown

MatchPredicate<V>

Function that tests the value, or a predicate factory result

T

Spec to use when predicate returns true

string

Optional description for AST introspection (defaults to predicate.toString())

MatchCase<T>