-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
When using node-fetch-cjs
as a dependency in a TypeScript project, I get the following errors during compilation:
> tsc --project .
node_modules/node-fetch-cjs/dist/index.d.ts:4:24 - error TS2307: Cannot find module 'formdata-polyfill/esm.min.js' or its corresponding type declarations.
4 import {FormData} from 'formdata-polyfill/esm.min.js';
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/node-fetch-cjs/dist/index.d.ts:12:8 - error TS2307: Cannot find module 'fetch-blob/from.js' or its corresponding type declarations.
12 } from 'fetch-blob/from.js';
~~~~~~~~~~~~~~~~~~~~
node_modules/node-fetch-cjs/dist/index.d.ts:24:2 - error TS2323: Cannot redeclare exported variable 'FormData'.
24 FormData,
~~~~~~~~
node_modules/node-fetch-cjs/dist/index.d.ts:25:2 - error TS2323: Cannot redeclare exported variable 'Blob'.
25 Blob,
~~~~
node_modules/node-fetch-cjs/dist/index.d.ts:221:14 - error TS2323: Cannot redeclare exported variable 'Blob'.
221 export const Blob: typeof globalThis.Blob;
~~~~
node_modules/node-fetch-cjs/dist/index.d.ts:223:22 - error TS2323: Cannot redeclare exported variable 'FormData'.
223 export declare const FormData: { new (): FormData; prototype: FormData; };
~~~~~~~~
Found 6 errors in the same file, starting at: node_modules/node-fetch-cjs/dist/index.d.ts:4
The workaround for this is to set skipLibCheck
to true
in tsconfig.json
:
"skipLibCheck": true,
Unfortunately this workaround "pollutes" the dependency chain, i.e. any package that uses a package that uses node-fetch-cjs
will have to do this.
Metadata
Metadata
Assignees
Labels
No labels