import type { FormAsyncValidateOrFn, ServerFormState, } from '@tanstack/react-form' interface ServerValidateErrorState< TFormData, TOnServer extends undefined | FormAsyncValidateOrFn, > { formState: ServerFormState response: Response } export class ServerValidateError< TFormData, TOnServer extends undefined | FormAsyncValidateOrFn, > extends Error implements ServerValidateErrorState { formState: ServerFormState response: Response constructor(options: ServerValidateErrorState) { super('Your form has errors. Please check the fields and try again.') this.name = 'ServerValidateError' this.response = options.response this.formState = options.formState } }