guardz-axios
Version:
Type-safe HTTP client built on top of Axios with runtime validation using guardz. Part of the guardz ecosystem for comprehensive TypeScript type safety.
12 lines • 617 B
TypeScript
import type { AxiosRequestConfig } from "axios";
import type { TypeGuardFn } from "guardz";
import type { SafeRequestConfig } from "../types/SafeRequestConfig";
import type { SafeRequestResult } from "../types/SafeRequestResult";
/**
* Pattern 2: Configuration-first (Apollo/React Query style)
* Usage: const result = await safeRequest({ url: '/users/1', method: 'GET', guard: isUser, ... });
*/
export declare function safeRequest<T>(requestConfig: AxiosRequestConfig & {
guard: TypeGuardFn<T>;
} & Omit<SafeRequestConfig<T>, "guard">): Promise<SafeRequestResult<T>>;
//# sourceMappingURL=safeRequest.d.ts.map