Typed response wrapper returned by convenience methods (.get, .post, etc.)

Provides parsed response data with full type safety, similar to axios responses.

Example

interface User { id: number; name: string }
const { data, status } = await api.get<User>('/api/user/1');
console.log(data.name); // fully typed
interface FejResponse<T> {
    data: T;
    status: number;
    statusText: string;
    headers: Headers;
    ok: boolean;
    raw: Response;
}

Type Parameters

  • T

Properties

data: T

Parsed response body (JSON, text, blob, etc.)

status: number

HTTP status code

statusText: string

HTTP status text

headers: Headers

Response headers

ok: boolean

true for 2xx status codes

raw: Response

Original Response object (escape hatch)