primus / eventemitter3

EventEmitter3 - Because there's also a number 2. And we're faster.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

import emitter by typescript throw error

allex opened this issue · comments

commented

failed when used in typescript project:

import {EventEmitter} from 'events';

throws

{ Error: 'EventEmitter' is not exported by node_modules/eventemitter3/index.js

could you please add pkg.module section for esm module ecosystem.

import should be import EventEmitter from 'events'; I think.
Could you try with this one https://www.npmjs.com/package/event-e3

On my side, no problem to use with TypeScript.
There's a typo in the code sample:

import {EventEmitter} from 'eventemitter3';

Closing as per @cedx comment.