Skip to content

product

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

Defined in: Core/Validation.ts:235

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

E

A

B

Validation<E, A>

Validation<E, B>

Validation<E, readonly [A, B]>

Validation.product(
  Validation.valid("alice"),
  Validation.valid(30)
); // Valid(["alice", 30])

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