andywer / andywer/typed-emitter

Updating to v2.0.0

未關閉
#28 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
JavaScript
星號
285
分支
29
PR 合併指標
30 天內沒有已合併 PR

描述

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!

貢獻指南

這個儲存庫沒有索引到貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。