Skip to content
0

katanakit-js / SafeResult

Type Alias: SafeResult<T, E> ​

ts
type SafeResult<T, E> = 
  | {
  data: T;
  error: null;
  ok: true;
}
  | {
  data: null;
  error: E;
  ok: false;
};

Defined in: src/types/index.ts:439

Generic Safe Result discriminated union (Astro Actions style): the ok flag narrows between the success and error branches and nothing is thrown.

Domain results below are aliases of this shape with a specific error type.

Type Parameters ​

Type ParameterDefault type
T-
EApiError

Released under the MIT License.