CacheControl / CacheControl/json-rules-engine

Type of `Engine.on()` is wrong

Aberta
#295 1 comentário 1 reação 0 responsáveis Ver no GitHub
Linguagem predominante
JavaScript
Estrelas
3.1k
Forks
507
Métricas de merge de PRs
Nenhum PR com merge em 30d

Descrição

If you register an event handler on a specific event (i.e. `Engine.on("my-event", ...)`), the first argument of the method will be the `params` of the `Event` definition (type: `Record`), not the `Event` object itself.

I'm not sure if this only the case for specific events or more generally the `EventHandler`:
https://github.com/CacheControl/json-rules-engine/blob/90272d61ed7bea8b7d4000305511e932490d2e2e/types/index.d.ts#L106-L110

Guia de contribuição

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

Direção de pesquisa

Start at types/index.d.ts around lines 106-110, linked from the issue, and compare the declared EventHandler type with the behavior of Engine.on("my-event", ...). Confirm what the callback receives for a specific event, then update the declaration so its first argument reflects the Event definition's params; add or adjust a type check if the repository provides one.

Escrita pelo modelo de indexação a partir do texto da issue.

Avaliação

Stack de tecnologia
javascript, typescript
Domínio
developer-experience
Tipo de issue
Bug
Dificuldade
2/5
Tempo estimado
1-3 horas
Status de atividade
Estagnada
Clareza
Razoavelmente clara
Facilidade para iniciantes
38/100

Receba novas issues na sua caixa de entrada

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