UNPKG

fets

Version:

TypeScript HTTP Framework focusing on e2e type-safety, easy setup, performance & great developer experience

19 lines (18 loc) 992 B
import { StatusCode, TypedResponse, TypedResponseCtor } from './typed-fetch.js'; import { JSONSerializer } from './types.js'; export declare const LAZY_SERIALIZED_RESPONSE: unique symbol; export declare const defaultSerializer: JSONSerializer; export interface LazySerializedResponse { [LAZY_SERIALIZED_RESPONSE]: true; resolveWithSerializer(serializer: JSONSerializer): void; init?: ResponseInit; actualResponse: Response; jsonObj: any; json: () => Promise<any>; status: StatusCode; headers: Headers; } export declare function isLazySerializedResponse(response: any): response is LazySerializedResponse; export declare function createLazySerializedResponse(jsonObj: any, init?: ResponseInit): LazySerializedResponse; export declare const Response: TypedResponseCtor; export type Response<TJSON = any, THeaders extends Record<string, string> = Record<string, string>, TStatusCode extends StatusCode = StatusCode> = TypedResponse<TJSON, THeaders, TStatusCode>;