Next.js Discord

Discord Forum

Form Action Typescript Type Error

Answered
Spectacled Caiman posted this in #help-forum
Open in Discord
Spectacled CaimanOP
Anyone know how to fix this typescript type error? Should I include all the key?

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] | undefined
Answered by Spectacled Caiman
This issue is caused by JetBrain IDE
https://youtrack.jetbrains.com/issue/WEB-61557
View full answer

5 Replies