You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Class static side 'typeof Emitter' incorrectly extends base class static side 'typeof EventEmitter' #385
When building the project with TS, I get the following error:
node_modules/cloudevents/dist/transport/emitter.d.ts:48:22 - error TS2417: Class static side 'typeof Emitter' incorrectly extends base class static side 'typeof EventEmitter'.
Types of property 'on' are incompatible.
Type '(event: "newListener" | "removeListener" | "cloudevent", listener: (...args: any[]) => void) => void' is not assignable to type '(emitter: EventEmitter, event: string) => AsyncIterableIterator<any>'.
Types of parameters 'event' and 'emitter' are incompatible.
Type 'EventEmitter' is not assignable to type '"newListener" | "removeListener" | "cloudevent"'.
Type 'EventEmitter' is not assignable to type '"cloudevent"'.
48 export declare class Emitter extends EventEmitter {
~~~~~~~
Hi @moltar if you could provide some steps to reproduce this, that would be great! Looking at the typescript example in this repository, I do not see this problem. Thanks. :)
I did some testing and it looks like it's caused by the version of @types/node being used. The typescript example in this repository is using @types/node@8.9.0 which is 3 years old. I'm currently using @types/node@14.14.10 and seeing the issue, and @moltar 's example is using 14.14 as well.
I downgraded to cloudevents@3.2.0 for now and it's compiling for me with the latest @types/node.
@lance can we get a pre-release or an alpha channel release? It's not easy to test this, because the code needs to be transpiled to be recognized by NPM.
Given that this is a community repo with established processes, we'll need to discuss it. But I think it is a good suggestion. I've opened an issue to track this #388.
Activity
lance commentedon Feb 18, 2021
Hi @moltar if you could provide some steps to reproduce this, that would be great! Looking at the typescript example in this repository, I do not see this problem. Thanks. :)
moltar commentedon Feb 19, 2021
Yup, here you go:
https://github.com/moltar/cloudevents-exp
Thanks!
danielgel commentedon Feb 23, 2021
+1
mnesbitt commentedon Feb 24, 2021
I'm having this issue as well in version 4.0.0.
I did some testing and it looks like it's caused by the version of
@types/nodebeing used. The typescript example in this repository is using@types/node@8.9.0which is 3 years old. I'm currently using@types/node@14.14.10and seeing the issue, and @moltar 's example is using 14.14 as well.I downgraded to
cloudevents@3.2.0for now and it's compiling for me with the latest@types/node.lance commentedon Feb 25, 2021
@mnesbitt thanks for that info. I'll take a look.
fix: Emitter should not extend EventEmitter
lance commentedon Feb 25, 2021
@mnesbitt @moltar @hilfor if you all have an opportunity to test this change in your project and provide feedback, that would be appreciated. Thanks!
moltar commentedon Feb 26, 2021
@lance can we get a pre-release or an alpha channel release? It's not easy to test this, because the code needs to be transpiled to be recognized by NPM.
I installed it from the PR:
But the dir does not have the packaged files:
moltar commentedon Feb 26, 2021
Reference: https://github.com/danillouz/til-npm-release-channels
fix: Emitter should not extend EventEmitter
lance commentedon Mar 3, 2021
@moltar thanks for bringing this up.
Given that this is a community repo with established processes, we'll need to discuss it. But I think it is a good suggestion. I've opened an issue to track this #388.