next-multiparty icon indicating copy to clipboard operation
next-multiparty copied to clipboard

Got an TS error with the `withFileUpload` method

Open MatteoGauthier opened this issue 3 years ago • 1 comments

Hey I use your lib on my projects but I always have an error here.

Capture d’écran 2022-10-28 à 13 38 59

Can you help me ?

MatteoGauthier avatar Oct 28 '22 11:10 MatteoGauthier

Oh hey @MatteoGauthier, for some reason I didn't get the Notification. You probably figured out the error already, but it's because with withFileUpload function updates the type of NextApiRequest so req.file is typed. You will need to change the types in your handler. Change your handler to


function handler(req: FormNextApiRequest, res: NextApiResponse) {
    // ... your code
}

cstrnt avatar Jan 06 '23 09:01 cstrnt