Result

type Result<T, E>

Result type for trust boundaries (protocol decode, save-file load, worker responses). Throwing is fine for programmer error; data arriving from storage, a worker, or eventually the network is not programmer error and callers must be forced to consider the failure.

packages/shared/src/result.ts:7

Type

{ ok: true; value: T } | { error: E; ok: false }