p-queue icon indicating copy to clipboard operation
p-queue copied to clipboard

eventemitter can only ve default-imported using the esModuleInterop flag

Open fabian-emilius opened this issue 3 years ago • 1 comments

I recently got the error after upgrading from 6.6.2 to 7.1.0:

node_modules/p-queue/dist/index.d.ts:1:8 - error TS1259: Module '"..../node_modules/eventemitter3/index"' can only be default-imported using the 'esModuleInterop' flag

I think this line has to be changed to import * as EventEmitter from 'eventemitter3' https://github.com/sindresorhus/p-queue/blob/76b81cd707a6cd31b41f25e5d7fa8abc7486c4bf/source/index.ts#L1

fabian-emilius avatar May 16 '21 13:05 fabian-emilius

Related issue on my side: I cannot use .on().. as it says on is not a defined method, I guess because it cannot find the corret import of eventemitter

simllll avatar May 17 '21 21:05 simllll

This is still an issue. Please update the import to import * as EventEmitter from 'eventemitter3'

Module '"node_modules/eventemitter3/index"' can only be default-imported using the 'allowSyntheticDefaultImports' flagts(1259)

index.d.ts(134, 1): This module is declared with 'export =', and can only be used with a default import when using the 'allowSyntheticDefaultImports' flag.

This is because node_modules\eventemitter3\index.d.ts does not have a default export.

Thank you.

AhmedToInfinity avatar Aug 30 '23 16:08 AhmedToInfinity