andywer / andywer/typed-emitter

Generics example for 2.x does not compile

Open
#32 13 comments 2 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
285
Forks
29
PR merge metrics
No merged PRs in 30d

Description

The example for generics in the documentation does not work:

```
class MyEventEmitter extends (EventEmitter as { new(): TypedEmitter }) {
// ...
}
```

Just gives `error TS2344: Type 'T' does not satisfy the constraint 'EventMap'.` on the `TypedEmitter` part...

TypeScript 4.5.5

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.