-
-
Notifications
You must be signed in to change notification settings - Fork 683
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Include typings for Typescript, for V2/V3 of Formidable #774
Comments
@karlhorky I saw you helped with types in the past, what should we do ? |
Thanks for the ping! I also ran into this problem when upgrading (since the internals of v2 are incompatible with v1). I fixed the problems that I encountered just as a patch (using diff --git a/node_modules/@types/formidable/index.d.ts b/node_modules/@types/formidable/index.d.ts
index 249da05..e4b4e50 100755
--- a/node_modules/@types/formidable/index.d.ts
+++ b/node_modules/@types/formidable/index.d.ts
@@ -208,12 +208,12 @@ declare namespace formidable {
* The path this file is being written to. You can modify this in the `'fileBegin'` event in case
* you are unhappy with the way formidable generates a temporary path for your files.
*/
- path: string;
+ filepath: string;
/**
* The name this file had according to the uploading client.
*/
- name: string | null;
+ originalFilename: string | null;
/**
* The mime type of this file, according to the uploading client. But of course this is not a solution for everyone... so continuing in the next comment 👇 |
So I would ask you, @GrosSacASac and @tunnckoCore, would the maintainers of
A less desirable alternative would be:
Oh and for people who are looking for a solution, @gboer has opened a PR to |
hehe yeah, I was about to add that :) But there are no types for v3 yet and in the long run, it would still be nice if the typings would be delivered with |
Yeah easiest long term and most beneficial would be if |
Yes, as I said here #500 I would welcome if someone makes a PR to add types in formidable. If one of you wants I can also give github formidable access so you can make a branch instead of a fork to make a PR. |
yes, totally. vould be rewritten to typescript, I'm open for that. |
small update, the types for Formidable V2 are now available in @types/formidable@2.0.0 :) |
I will happily convert v3 to a typesafe version, but I could not find the branch 😁 PS: Found it, began the work 😊 |
@Akxe v3 is |
The typescript rewrite is quite hard without major changes to the codebase. There is a lot of I would usually do either: Parsers/plugins as standalone classesthat do not share anything with the They would expose API that the Parsers as an extension of
|
@Akxe they already are extensions/plugins.
No problemo. The
Good point. |
You may want to merge this before treating anything from the types repo as a starting point, FYI. |
Support plan
Context
What problem are you trying to solve?
I am trying to upgrade to Formidable V2 or V3, but since there are no typings available for this version, it is incredibly time-consuming to figure out how the API looks and what I need to place where. Since this project is downloaded millions of times per week, I can only assume that a lot of other people are running into the same issue. This makes adopting the new version unlikely, any time soon.
Do you have a new or modified API suggestion to solve the problem?
Include the typings with the new version.
The text was updated successfully, but these errors were encountered: