From 2d1a6f2db29951573bd6c0962a6433a1f98d7019 Mon Sep 17 00:00:00 2001 From: Paul Grau Date: Fri, 4 Aug 2023 19:22:42 +0900 Subject: [PATCH] fix(Form): fix wrong type of validate (#496) Co-authored-by: Benjamin Canac --- docs/content/3.forms/10.form.md | 4 ++-- src/runtime/types/form.d.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/content/3.forms/10.form.md b/docs/content/3.forms/10.form.md index c392f5c90..aa563dae3 100644 --- a/docs/content/3.forms/10.form.md +++ b/docs/content/3.forms/10.form.md @@ -248,7 +248,7 @@ const schema = z.object({ password: z.string().min(8, 'Must be at least 8 characters') }) -const state: Partial = ref({ +const state = ref>({ email: undefined, password: undefined }) @@ -259,7 +259,7 @@ type Schema = z.output const form = ref>() async function submit() { - const data: Schema = await form.value!.validate() + const data = await form.value!.validate() // Do something with data } diff --git a/src/runtime/types/form.d.ts b/src/runtime/types/form.d.ts index 5bd37b783..2ccba2008 100644 --- a/src/runtime/types/form.d.ts +++ b/src/runtime/types/form.d.ts @@ -4,7 +4,7 @@ export interface FormError { } export interface Form { - async validate(): T + validate(): Promise } export interface FormEvent {