import type { FormAsyncValidateOrFn, FormOptions, FormValidateOrFn, } from './FormApi' /* These types need to do two things: 1. Validator generics need to depend on the TFormData generic 2. The resulting needs to allow overriding values The generics from formOptions almost work, except that it loses information about how to infer TFormData. If you pass a validator function, it tries to resolve the `formApi` or `value` inside of it, meaning that TFormData changes to `unknown`. To bypass this, the intersection for defaultOpts gives TypeScript that information again, without losing the benefits from the TOptions generic. */ export function formOptions< TOptions extends Partial< FormOptions< TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer, TSubmitMeta > >, TFormData, TOnMount extends undefined | FormValidateOrFn, TOnChange extends undefined | FormValidateOrFn, TOnChangeAsync extends undefined | FormAsyncValidateOrFn, TOnBlur extends undefined | FormValidateOrFn, TOnBlurAsync extends undefined | FormAsyncValidateOrFn, TOnSubmit extends undefined | FormValidateOrFn, TOnSubmitAsync extends undefined | FormAsyncValidateOrFn, TOnDynamic extends undefined | FormValidateOrFn, TOnDynamicAsync extends undefined | FormAsyncValidateOrFn, TOnServer extends undefined | FormAsyncValidateOrFn, TSubmitMeta = never, >( defaultOpts: Partial< FormOptions< TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer, TSubmitMeta > > & TOptions, ): TOptions { return defaultOpts }