Form Action Typescript Type Error
Answered
Spectacled Caiman posted this in #help-forum
Spectacled CaimanOP
Anyone know how to fix this typescript type error? Should I include all the key?
Typescript error:
async function formHandler(formData: FormData) {
'use server';
register({
user_email: formData.get(FormKey.Email),
user_name: formData.get(FormKey.Username),
user_password: formData.get(FormKey.Password),
} as RegisterProps);
}<form className={'flex flex-col gap-4'} action={formHandler}>Typescript error:
Type (formData: FormData) => Promise<void> is not assignable to type string | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS] | undefinedAnswered by Spectacled Caiman
This issue is caused by JetBrain IDE
https://youtrack.jetbrains.com/issue/WEB-61557
https://youtrack.jetbrains.com/issue/WEB-61557
5 Replies
Spectacled CaimanOP
@James4u I follow the tutorial on next-safe-action, but got this:
Spectacled CaimanOP
This issue is caused by JetBrain IDE
https://youtrack.jetbrains.com/issue/WEB-61557
https://youtrack.jetbrains.com/issue/WEB-61557
Answer