CacheControl / CacheControl/json-rules-engine

Type of `Engine.on()` is wrong

Open
#295 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
3.1k
Forks
507
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

Research direction

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.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
developer-experience
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.