remix-validated-form 5.0.0 → 5.0.1

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.d.ts CHANGED
@@ -175,7 +175,7 @@ declare const setFormDefaults: <DataType = any>(formId: string, defaultValues: P
175
175
  type SubactionData<DataType, Subaction extends string | undefined> = DataType & {
176
176
  subaction: Subaction;
177
177
  };
178
- type DefaultValuesForSubaction<DataType, Subaction extends string | undefined> = Subaction extends string ? SubactionData<DataType, Subaction> extends undefined ? DataType : SubactionData<DataType, Subaction> : DataType;
178
+ type DataForSubaction<DataType, Subaction extends string | undefined> = Subaction extends string ? SubactionData<DataType, Subaction> extends undefined ? DataType : SubactionData<DataType, Subaction> : DataType;
179
179
  type FormProps<DataType, Subaction extends string | undefined> = {
180
180
  /**
181
181
  * A `Validator` object that describes how to validate the form.
@@ -185,7 +185,7 @@ type FormProps<DataType, Subaction extends string | undefined> = {
185
185
  * A submit callback that gets called when the form is submitted
186
186
  * after all validations have been run.
187
187
  */
188
- onSubmit?: (data: DataType, event: React.FormEvent<HTMLFormElement>) => void | Promise<void>;
188
+ onSubmit?: (data: DataForSubaction<DataType, Subaction>, event: React.FormEvent<HTMLFormElement>) => void | Promise<void>;
189
189
  /**
190
190
  * Allows you to provide a `fetcher` from Remix's `useFetcher` hook.
191
191
  * The form will use the fetcher for loading states, action data, etc
@@ -196,7 +196,7 @@ type FormProps<DataType, Subaction extends string | undefined> = {
196
196
  * Accepts an object of default values for the form
197
197
  * that will automatically be propagated to the form fields via `useField`.
198
198
  */
199
- defaultValues?: Partial<DefaultValuesForSubaction<DataType, Subaction>>;
199
+ defaultValues?: Partial<DataForSubaction<DataType, Subaction>>;
200
200
  /**
201
201
  * A ref to the form element.
202
202
  */