andywer / andywer/typed-emitter

Updating to v2.0.0

Aberta
#28 1 comentário 0 reações 0 responsáveis Ver no GitHub
Linguagem predominante
JavaScript
Estrelas
285
Forks
29
Métricas de merge de PRs
Nenhum PR com merge em 30d

Descrição

Hey!
I just installed typed-emitter v2.0.0 and am not sure how to use it now.
The code that worked previously and that still follows what is in the readme,
```ts
import EventEmitter from "events"
import TypedEmitter from "typed-emitter"

interface MyEvents {
"finish": (results: any[]) => void
}

export class MyClass extends (EventEmitter as new () => TypedEmitter) {
}
```
now errors on `EventEmitter as new () => TypedEmitter`

```error
Conversion of type 'typeof EventEmitter' to type 'new () => TypedEventEmitter' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
Types of construct signatures are incompatible.
Type 'new (options?: EventEmitterOptions) => EventEmitter' is not assignable to type 'new () => TypedEventEmitter'.
Property '__events' is missing in type 'EventEmitter' but required in type 'TypedEventEmitter'.ts(2352)
index.d.ts(46, 3): '__events' is declared here.
```
Downgrading to typed-emitter@^1 and it works again, so how do i get this to work on v2?
Thanks!

Guia de contribuição

Nenhum guia de contribuição indexado para este repositório

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.