Skip to content

struct

struct<E, R>(fields): Result<E, R>

Defined in: Core/Result.ts:349

Combines a record of Results into a single Result of a record. Evaluates fields in key order and short-circuits on the first failure.

E

R extends Record<string, any>

{ [K in string | number | symbol]: Result<E, R[K]> }

Result<E, R>

Result.struct({
  name: Result.ok("Alice"),
  age: Result.ok(30)
}); // Ok({ name: "Alice", age: 30 })