Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[2.x] Remove data option from useForm options type #2060

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

pedroborges
Copy link
Collaborator

@pedroborges pedroborges commented Oct 23, 2024

The inclusion of data in VisitOptions can be misleading when using useForm. We should update the type definitions to exclude the data property in this context to prevent confusion.

Closes #2056.

@@ -7,6 +7,7 @@ type setDataByObject<TForm> = (data: TForm) => void
type setDataByMethod<TForm> = (data: (previousData: TForm) => TForm) => void
type setDataByKeyValuePair<TForm> = <K extends keyof TForm>(key: K, value: TForm[K]) => void
type FormDataType = object
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By the way, the FormDataType in the Svelte adapter is more specific than the other two adapters.

Suggested change
type FormDataType = object
type FormDataType = Record<string, FormDataConvertible>

@@ -4,6 +4,7 @@ import isEqual from 'lodash.isequal'
import { reactive, watch } from 'vue'

type FormDataType = object
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
type FormDataType = object
type FormDataType = Record<string, FormDataConvertible>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

useForm submit should accept data
1 participant