facebook / facebook/flow

EventEmitter when inherited deeply does not respect parent type

Aperta
#3,329 0 commenti 2 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Rust
Stelle
22.3k
Fork
1.9k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

I am having an issue involving class inheritance and EventEmitter in the following scenario:
```
class A extends EventEmitter

class B extends A

const test: B = new B()

events$EventEmitter. This type is incompatible with B
```

Is there a way to avoid this?

From what it looks like, the type of B is class B on the const declaration, but new B() is the type of events$EventEmitter, which is inherited from type A.

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.