Skip to content

Commit

Permalink
fix(Form): fix wrong type of validate (#496)
Browse files Browse the repository at this point in the history
Co-authored-by: Benjamin Canac <[email protected]>
  • Loading branch information
graup and benjamincanac authored Aug 4, 2023
1 parent 7dcf591 commit 2d1a6f2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions docs/content/3.forms/10.form.md
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ const schema = z.object({
password: z.string().min(8, 'Must be at least 8 characters')
})
const state: Partial<Schema> = ref({
const state = ref<Partial<Schema>>({
email: undefined,
password: undefined
})
Expand All @@ -259,7 +259,7 @@ type Schema = z.output<typeof schema>
const form = ref<Form<Schema>>()
async function submit() {
const data: Schema = await form.value!.validate()
const data = await form.value!.validate()
// Do something with data
}
</script>
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/types/form.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export interface FormError {
}

export interface Form<T> {
async validate(): T
validate(): Promise<T>
}

export interface FormEvent {
Expand Down

1 comment on commit 2d1a6f2

@vercel
Copy link

@vercel vercel bot commented on 2d1a6f2 Aug 4, 2023

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

ui – ./

ui-git-dev-nuxtlabs.vercel.app
ui-nuxtlabs.vercel.app
ui.nuxtlabs.com

Please sign in to comment.