TS2350

Only a void function can be called with the 'new' keyword.

Broken Code ❌

return new NextResponse.json({ message: 'File received successfully' }, 200);

This error occurs because NextResponse.json() is a static method and not a constructor. Therefore, it shouldn't be used with the new keyword.

Fixed Code ✔️

Remove the new keyword when calling NextResponse.json():

return NextResponse.json({ message: 'File received successfully' }, 200);

This way, you're correctly invoking the static method without trying to instantiate it.