question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Class static side 'typeof Emitter' incorrectly extends base class static side 'typeof EventEmitter'

See original GitHub issue

Describe the Bug

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 {
                       ~~~~~~~
    "cloudevents": "4.0.0",
    "@types/node": "14.14.27",
    "typescript": "4.1.3"

Steps to Reproduce

N/A

Expected Behavior

Build passing.

Additional context

    "cloudevents": "4.0.0",
    "@types/node": "14.14.27",
    "typescript": "4.1.3"

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
lancecommented, 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 https://github.com/cloudevents/sdk-javascript/issues/388.

1reaction
mnesbittcommented, 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/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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

RN: Class static side 'typeof *' incorrectly extends base class ...
The correct fix here is to properly type the BaseModel.database return value. In this case, I believe it should return an async function,...
Read more >
Class static side 'typeof Org' incorrectly extends base class ...
When trying to run the default hello:org command this is the error produced: src/commands/hello/org.ts(11,22): error TS2417: Class static side ' ...
Read more >
UpgradeComponent - Angular
A helper class that allows an AngularJS component to be used from Angular. ... Part of the upgrade/static library for hybrid upgrade apps...
Read more >
Is it possible to instantiate child class from a static method in ...
class Base { static find(id) { const attributes = 'foo'; ... Class static side 'typeof _Readable' incorrectly extends base class static side 'typeof...
Read more >
Node.js v19.3.0 Documentation
byteLength(string[, encoding]); Static method: Buffer.compare(buf1, buf2); Static method: ... Server-side example; Client-side example; Class: Http2Session.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found