Skip to content

FetchResult

katanakit-js / FetchResult

type FetchResult<T> =
| {
data: T;
error: null;
ok: true;
status: number;
url: string;
}
| {
data: null;
error: ApiError;
ok: false;
status: number;
url: string;
};

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

Safe result, discriminated union (Astro Actions style) without throwing. The ok flag narrows the union between the success and error branches.

Type Parameter Default type
T unknown