andywer / andywer/typed-emitter

optional context not typed

未关闭
#42 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
JavaScript
星标
285
派生
29
PR 合并指标
30 天内没有已合并 PR

描述

This is great for providing typed events, however, there doesn't seem to be any allowance for the optional context that can be passed to an event.

`PlayBus.on('botDestroyed', this.attemptSpawn, this)`

The above code is correct and passes the context correctly to eventemitter3, but typescript complains about the 'this'. Is this a mistake?
Should for example:

` on (event: E, listener: Events[E]): this`

instead be:

` on (event: E, listener: Events[E], context?: any): this`

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。