andywer / andywer/typed-emitter
Updating to v2.0.0
- 主要语言
- 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 还没有评估数据。