-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Open
Labels
Description
Describe the problem
This is an extremely small issue, but I figured I would make an issue for it.
For form actions, you can expose the enhance form type like so:
import type { SubmitFunction } from '@sveltejs/kit';
const onSubmit: SubmitFunction<MyFormType> = async ({ formElement }) => {But there is no SubmitFunction for Remote Functions.
Describe the proposed solution
const onSubmit: SubmitRemoteFunction<myForm> = async ({ submit }) => {Alternatives considered
Just use the Parameters to derive it (this is the workaround for now):
type SubmitRemoteFunction = Parameters<typeof myForm.enhance>[0];
const onSubmit: SubmitRemoteFunction = async ({ submit }) => {
try {
await submit();
} catch (error) {
console.error(error);
}
};
<form {...myForm.preflight(myFormSchema).enhance(onSubmit)}>Importance
nice to have
Additional Information
Extremely small issue, but extremely easy to fix too.
SkepticMystic