'FormData' refers to a value, but is being used as a type here
See original GitHub issueReproduction
Hi, I’ve got some issues with node-fetch v3.2.10 while trying to upgrade from v2.6.7 (tbf these issues appeared starting from v3.0.0).
When trying to compile typescript getting
node_modules/formdata-polyfill/esm.min.d.ts:2:11 - error TS2749: 'FormData' refers to a value, but is being used as a type here. Did you mean 'typeof FormData'?
2 new (): FormData;
~~~~~~~~
Or
node_modules/node-fetch/@types/index.d.ts:137:22 - error TS2749: 'FormData' refers to a value, but is being used as a type here. Did you mean 'typeof FormData'?
137 formData(): Promise<FormData>;
~~~~~~~~
Expected behavior
I expect not to get any issue
Your Environment
software | version |
---|---|
node-fetch | 3.2.10 |
node | 18.1.0 |
yarn | 3.2.0 |
Operating System | WSL2.0 Ubuntu 20.04, Windows 10 |
Tried typescript v.4.7.4 and v4.8.4, both gets the same result
Issue Analytics
- State:
- Created a year ago
- Reactions:8
- Comments:5
Top Results From Across the Web
ReactJS and Typescript : refers to a value, but is being used ...
I ran across this same x refers to a value, but is being used as a type here. Did you mean 'typeof x'?...
Read more >"refers to a value, but is being used as a type here ... - Reddit
I'm hoping to get some insight into why I'm getting this error. I have a React functional component, and in a helper function...
Read more >Uncontrolled Components - React
In a controlled component, form data is handled by a React component. The alternative is uncontrolled components, where form data is handled by...
Read more >Typescript support - FormData type errors persist! -
node_modules/mailgun.js/dist/index.d.ts(5,51): error TS2749: 'FormData' refers to a value, but is being used as a type here.
Read more >typescript-cheatsheet - GitHub Pages
The cheatsheet contains references to types, classes, decorators, ... More on what class inheritance is all about just below, but here's an example;....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This issue is likely to be a duplicate of #1617, introduced in #1287. Workarounds are to revert to v3.2.8 or add
DOM
to the libraries included in tsconfig.Yes, I am eagerly awaiting for the AWS Lambda runtime support for Node 18. In the meantime I’m thinking of reverting to an older
node-fetch
and using that until the runtime with native fetch is supported.