Node-slack-sdk: TypeScript build failure related to EventEmitter types

Created on 29 Jan 2020  路  7Comments  路  Source: slackapi/node-slack-sdk

Description

New builds on Travis are currently failing (since 8 days ago) with the following errors:

src/adapter.ts:16:40 - error TS2507: Type 'typeof EventEmitter' is not a constructor function type.
16 export class SlackEventAdapter extends EventEmitter {
                                          ~~~~~~~~~~~~
src/http-handler.ts:115:17 - error TS2339: Property 'emit' does not exist on type 'SlackEventAdapter'.
115         adapter.emit('error', error, respond);
                    ~~~~
src/http-handler.ts:117:17 - error TS2339: Property 'emit' does not exist on type 'SlackEventAdapter'.
117         adapter.emit('error', error);
                    ~~~~
src/http-handler.ts:121:17 - error TS2339: Property 'emit' does not exist on type 'SlackEventAdapter'.
121         adapter.emit('error', error);
                    ~~~~
src/http-handler.ts:202:19 - error TS2339: Property 'emit' does not exist on type 'SlackEventAdapter'.
202           adapter.emit(body.event.type, ...emitArguments);
                      ~~~~
Found 5 errors.

There seems to be an issue with the type definitions for eventemitter3.

Requirements (place an x in each of the [ ])

  • [x] I've read and understood the Contributing guidelines and have done my best effort to follow them.
  • [x] I've read and agree to the Code of Conduct.
  • [x] I've searched for any related issues and avoided creating a duplicate issue.
tests

Most helpful comment

@pacjin79 The reason for that is that you're using @types/node 13.x. @types/node 13 has applied a breaking change to the EventEmitter type definition. Our package is compatible with the latest LTS release (=12).

If you're not intentionally relying on Node 13, consider specifying 12 in package.json as we do. https://github.com/slackapi/node-slack-sdk/pull/958/files

All 7 comments

It looks like there was a pretty significant refactor of events.d.ts in the release of @types/[email protected]:

https://github.com/DefinitelyTyped/DefinitelyTyped/commit/19826ba267c2203e61d28b87f56ca28eac23a994#diff-7d7d86e4d89d5a8d8e623c8873828549

This likely caused most recent builds to grab that version and the import of EventEmitter to fail.

will this update be pushed to the npm registry anytime soon?

@http417 this update is out now! it is part of @slack/[email protected]. sorry for the delay.

still an issue after I updated to events-api 2.3.2

screenshot_207

@pacjin79 The reason for that is that you're using @types/node 13.x. @types/node 13 has applied a breaking change to the EventEmitter type definition. Our package is compatible with the latest LTS release (=12).

If you're not intentionally relying on Node 13, consider specifying 12 in package.json as we do. https://github.com/slackapi/node-slack-sdk/pull/958/files

We may revisit this issue when we start supporting Node 14 in the future. That said, I think we should close this issue for now as we don't have any further actions to take until then.

@seratch Maybe it's time now then :) Since v14.15.1 was the released, this repo README clearly says you do, so I was confused by this for quite a while.

https://github.com/slackapi/node-slack-sdk#requirements

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jayjanssen picture jayjanssen  路  13Comments

aoberoi picture aoberoi  路  10Comments

CoreyCole picture CoreyCole  路  12Comments

dcsan picture dcsan  路  12Comments

aoberoi picture aoberoi  路  12Comments