Skip to content

SafeResult

katanakit-js / SafeResult

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

Defined in: types/core/http.ts:60

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 Parameter Default type
T -
E ApiError