import { ErrorValue, FormDataErrors, FormDataKeys, FormDataType, FormDataValues, Method, Progress, UrlMethodPair, UseFormTransformCallback, UseFormWithPrecognitionArguments, UseHttpSubmitArguments, UseHttpSubmitOptions } from '@inertiajs/core'; import { NamedInputEvent, ValidationConfig, Validator } from 'laravel-precognition'; export interface UseHttpProps { isDirty: boolean; errors: FormDataErrors; hasErrors: boolean; processing: boolean; progress: Progress | null; wasSuccessful: boolean; recentlySuccessful: boolean; response: TResponse | null; data(): TForm; transform(callback: UseFormTransformCallback): this; defaults(): this; defaults>(field: T, value: FormDataValues): this; defaults(fields: Partial): this; reset>(...fields: K[]): this; clearErrors>(...fields: K[]): this; resetAndClearErrors>(...fields: K[]): this; setError>(field: K, value: ErrorValue): this; setError(errors: FormDataErrors): this; submit(...args: UseHttpSubmitArguments): Promise; get(url: string, options?: UseHttpSubmitOptions): Promise; post(url: string, options?: UseHttpSubmitOptions): Promise; put(url: string, options?: UseHttpSubmitOptions): Promise; patch(url: string, options?: UseHttpSubmitOptions): Promise; delete(url: string, options?: UseHttpSubmitOptions): Promise; cancel(): void; dontRemember>(...fields: K[]): this; optimistic(callback: (currentData: TForm) => Partial): this; withAllErrors(): this; withPrecognition(...args: UseFormWithPrecognitionArguments): UseHttpPrecognitiveProps; } type PrecognitionValidationConfig = ValidationConfig & { only?: TKeys[] | Iterable | ArrayLike; }; export interface UseHttpValidationProps { invalid>(field: K): boolean; setValidationTimeout(duration: number): this; touch>(field: K | NamedInputEvent | Array, ...fields: K[]): this; touched>(field?: K): boolean; valid>(field: K): boolean; validate>(field?: K | NamedInputEvent | PrecognitionValidationConfig, config?: PrecognitionValidationConfig): this; validateFiles(): this; validating: boolean; validator: () => Validator; withAllErrors(): this; withoutFileValidation(): this; setErrors(errors: FormDataErrors | Record): this; forgetError | NamedInputEvent>(field: K): this; } interface InternalPrecognitionState { __touched: string[]; __valid: string[]; } export type UseHttp = TForm & UseHttpProps; export type UseHttpPrecognitiveProps = UseHttp & UseHttpValidationProps & InternalPrecognitionState; export default function useHttp, TResponse = unknown>(method: Method | (() => Method), url: string | (() => string), data: TForm | (() => TForm)): UseHttpPrecognitiveProps; export default function useHttp, TResponse = unknown>(urlMethodPair: UrlMethodPair | (() => UrlMethodPair), data: TForm | (() => TForm)): UseHttpPrecognitiveProps; export default function useHttp, TResponse = unknown>(rememberKey: string, data: TForm | (() => TForm)): UseHttp; export default function useHttp, TResponse = unknown>(data: TForm | (() => TForm)): UseHttp; export default function useHttp, TResponse = unknown>(): UseHttp; export {};