andywer / andywer/typed-emitter

optional context not typed

Aberta
#42 0 comentários 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

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`

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.