Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Types definitions #10

Open
rtalexk opened this issue Jan 27, 2022 · 5 comments
Open

Types definitions #10

rtalexk opened this issue Jan 27, 2022 · 5 comments

Comments

@rtalexk
Copy link

rtalexk commented Jan 27, 2022

2022-01-27 12 41 11

In the docs it says it uses the same API as formidable. There's an easy and straightforward to extend the type definitions from formidable to formidable-serverless?

I was thinking in installing like this:

npm i --save formidable-serverless
i --save-dev @types/formidable

And somehow instruct Node to use formidable's types for formidable-serverless.

@Amit-A
Copy link
Owner

Amit-A commented Jan 28, 2022

Yes the types from formidable should work for formidable-serverless as long as the versions match.

I might just create/publish @types/formidable-serverless when I get the chance...

@APU-Stark
Copy link

is it done ? @types/ ?

@ABDERRAHMANE-OUALI
Copy link

a workaround for the error is to use CommonJS import for that
const formidable = require("formidable-serverless");

@AverageHelper
Copy link

AverageHelper commented Dec 14, 2022

Wouldn't that mean formidable is of type any?

EDIT: Could probably cast the above to some variation of typeof import("formidable") to avoid disabling TypeScript unnecessarily.

@biladinn
Copy link

biladinn commented Apr 27, 2023

A workaround for this is to copy code from formidable-serverless.js and make a file in your project and paste that code there and then just use import formidable from "./formidable-serverless"; this is the best solution that we have so far. Thanks everyone. I think this issue can be closed for now. (Edit: This solution supports TypeScript)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants