useFormState get error highlighting in vscode
Unanswered
Kangal Shepherd Dog posted this in #help-forum
Kangal Shepherd DogOP
Hey guys i'm using useFormState to get state update, but i got error highlighting in vscode, can you help?
Thanks 🙏.
vscode errror:
No overload matches this call.
Overload 1 of 2, '(action: (state: { error: string; }) => { error: string; } | Promise<{ error: string; }>, initialState: { error: string; }, permalink?: string | undefined): [state: { error: string; }, dispatch: () => void, isPending: boolean]', gave the following error.
Argument of type '(formData: FormData) => Promise<ActionResult>' is not assignable to parameter of type '(state: { error: string; }) => { error: string; } | Promise<{ error: string; }>'.
Types of parameters 'formData' and 'state' are incompatible.
Type '{ error: string; }' is missing the following properties from type 'FormData': append, delete, get, getAll, and 7 more.
Overload 2 of 2, '(action: (state: { error: string; }, payload: unknown) => { error: string; } | Promise<{ error: string; }>, initialState: { error: string; }, permalink?: string | undefined): [state: { error: string; }, dispatch: (payload: unknown) => void, isPending: boolean]', gave the following error.
Argument of type '(formData: FormData) => Promise<ActionResult>' is not assignable to parameter of type '(state: { error: string; }, payload: unknown) => { error: string; } | Promise<{ error: string; }>'.
Types of parameters 'formData' and 'state' are incompatible.
Type '{ error: string; }' is missing the following properties from type 'FormData': append, delete, get, getAll, and 7 more.ts(2769)
Thanks 🙏.
vscode errror:
No overload matches this call.
Overload 1 of 2, '(action: (state: { error: string; }) => { error: string; } | Promise<{ error: string; }>, initialState: { error: string; }, permalink?: string | undefined): [state: { error: string; }, dispatch: () => void, isPending: boolean]', gave the following error.
Argument of type '(formData: FormData) => Promise<ActionResult>' is not assignable to parameter of type '(state: { error: string; }) => { error: string; } | Promise<{ error: string; }>'.
Types of parameters 'formData' and 'state' are incompatible.
Type '{ error: string; }' is missing the following properties from type 'FormData': append, delete, get, getAll, and 7 more.
Overload 2 of 2, '(action: (state: { error: string; }, payload: unknown) => { error: string; } | Promise<{ error: string; }>, initialState: { error: string; }, permalink?: string | undefined): [state: { error: string; }, dispatch: (payload: unknown) => void, isPending: boolean]', gave the following error.
Argument of type '(formData: FormData) => Promise<ActionResult>' is not assignable to parameter of type '(state: { error: string; }, payload: unknown) => { error: string; } | Promise<{ error: string; }>'.
Types of parameters 'formData' and 'state' are incompatible.
Type '{ error: string; }' is missing the following properties from type 'FormData': append, delete, get, getAll, and 7 more.ts(2769)
2 Replies
Kangal Shepherd DogOP
Yo guys
Kangal Shepherd DogOP
Solved, add parameter in action function (_: any, formData: FormData): Promise<ActionResult>