Skip to content

Add eventemitter2 support AMD and Webpack - #5831

Closed
thakerng wants to merge 1 commit into
DefinitelyTyped:masterfrom
nodeframe:master
Closed

thakerng wants to merge 1 commit into
DefinitelyTyped:masterfrom
nodeframe:master

Conversation

@thakerng

Copy link
Copy Markdown

Traditional eventemitter2.d.ts has problem with webpack because it emits EventEmitter directly not exports.EventEmitter2

@vvakame

vvakame commented Sep 20, 2015

Copy link
Copy Markdown
Member

@thakerng why do you not modify eventemitter2/eventemitter2.d.ts directly? what's different do it have?

@thakerng

Copy link
Copy Markdown
Author

I think this modification will be resolved in tsd registry

@shlomiassaf

Copy link
Copy Markdown
Contributor

Guys, what about merging this patch?

The issue is very simple, to require EventEmitter2 one will write:

import EventEmitter2 = require('eventemitter2');

We can all agree the now EventEmitter2 references the EventEmiter2 constructor function/type/class whatever you choose.

But, the definition file is doing something wrong, it does

declare module "eventemitter2" {
    export class EventEmitter2 ...
}

The compiler now thinks the class is in EventEmitter2.EventEmitter2.

To workaround that a patch is required:

require('eventemitter2').EventEmitter2 = require('eventemitter2');

Also, note that in the definition file there is a private class defined (EventEmitter2).
The declaration of the module "eventemiter2" should just include export = EventEmiter2 but it does not, instead it rewrites the whole class again... not good.

@RyanCavanaugh

Copy link
Copy Markdown
Member

Hello and thank you for your contribution!

Due to an excessively long queue of pull requests that have become stale, we are "declaring bankruptcy" and closing all PRs opened before May 1, 2016. If you'd still like to merge this code in, please open a new PR that has been merged and rebased with the master branch.

Going forward, we are committing to review or merge all PRs on a regular basis so this bankruptcy will not occur again. We apologize for the incovenience and hope you will continue to contribute to DefinitelyTyped in the future.

Thanks
The TypeScript and DefinitelyTyped teams

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants