Skip to content
0

katanakit-js / FetchResult

Type Alias: FetchResult<T> ​

ts
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: src/types/index.ts:446

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

Type Parameters ​

Type ParameterDefault type
Tunknown

Released under the MIT License.