Skip to content

product

product<E, A, B>(first, second): Validation<E, readonly [A, B]>

Defined in: Core/Validation.ts:340

Combines two independent Validation instances into a tuple. If both are Passed, returns Passed with both values as a tuple. If either is Failed, accumulates errors from both sides.

E

A

B

Validation<E, A>

Validation<E, B>

Validation<E, readonly [A, B]>

Validation.product(
  Validation.passed("alice"),
  Validation.passed(30)
); // Passed(["alice", 30])

Validation.product(
  Validation.failed("Name required"),
  Validation.failed("Age must be >= 0")
); // Failed(["Name required", "Age must be >= 0"])