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 <canacb1@gmail.com>
  • Loading branch information
graup and benjamincanac committed Sep 7, 2023
1 parent 8b19b18 commit 3d6839d
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

0 comments on commit 3d6839d

Please sign in to comment.