-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
Milestone
Description
Describe the bug
Follow up to #7608, use:enhance throws a type error when using an async callback because the SubmitFunction interface does not expect any Promise-like return value.
Reproduction
Use an async function as the callback for any use:enhance action.
Logs
Type '({ cancel, data }: { action: URL; data: FormData; form: HTMLFormElement; controller: AbortController; cancel(): void; }) => Promise<void | (({ update, result }: { form: HTMLFormElement; action: URL; result: ActionResult<...>; update(options?: { ...; } | undefined): Promise<...>; }) => Promise<...>)>' is not assignable to type 'SubmitFunction<Record<string, any>, Record<string, any>>'.
Type 'Promise<void | (({ update, result }: { form: HTMLFormElement; action: URL; result: ActionResult<Record<string, any>, Record<string, any>>; update(options?: { ...; } | undefined): Promise<...>; }) => Promise<...>)>' is not assignable to type 'void | ((opts: { form: HTMLFormElement; action: URL; result: ActionResult<Record<string, any>, Record<string, any>>; update(options?: { ...; } | undefined): Promise<...>; }) => void)'.
System Info
System:
OS: Windows 10 10.0.22621
CPU: (12) x64 Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz
Memory: 15.90 GB / 31.75 GB
Binaries:
Node: 16.17.1 - C:\Program Files\nodejs\node.EXE
npm: 8.9.0 - ~\AppData\Roaming\npm\npm.CMD
Browsers:
Edge: Spartan (44.22621.891.0), Chromium (107.0.1418.42)
Internet Explorer: 11.0.22621.1
npmPackages:
@sveltejs/adapter-vercel: 1.0.0-next.81 => 1.0.0-next.81
@sveltejs/kit: 1.0.0-next.544 => 1.0.0-next.544
svelte: ^3.53.1 => 3.53.1
vite: ^3.2.3 => 3.2.3Severity
annoyance
Additional Information
No response