Skip to main content
Version: v8.0.0

ResponseType

The normalized response shape returned by every adapter after a request completes.


Import
import { ResponseType } from "@hyper-fetch/core"

Preview

type ResponseType<GenericDataType,GenericErrorType,Adapter> = {
data: GenericDataType | null;
error: GenericErrorType | null;
extra: ExtractAdapterExtraType<Adapter> | null;
requestTimestamp: number;
responseTimestamp: number;
status: ExtractAdapterStatusType<Adapter> | null;
success: boolean;
}

Structure

ResponseType
NameTypeDescription
data
GenericDataType | null

Response data when successful, null on error

error
GenericErrorType | null

Error payload when the request fails, null on success

extra
ExtractAdapterExtraType<Adapter> | null

Adapter-specific metadata (e.g., response headers)

requestTimestamp
number

Timestamp (ms) when the request was sent

responseTimestamp
number

Timestamp (ms) when the response was received

status
ExtractAdapterStatusType<Adapter> | null

HTTP status code or adapter-specific status indicator

success
boolean

Whether the request completed successfully