facebook / facebook/flow

EventEmitter when inherited deeply does not respect parent type

Open
#3,329 0 comments 2 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
22.3k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.