Change EventType
to an interface with a type argument
#110
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Brief Description
Change
EventType
to an interface with a type argument so that thedata
attribute can be typed implicitly. For example, once you set the event type toEventType<EVENT_ATTACK>
the data takes on the typeEventData[EVENT_ATTACK]
. This also lets the type of data be addressable so you can write functions that expect a certain type of event data.This also fixes #109 as
EventType
incorrectly used type instead of event.Checklists
src/
files notindex.d.ts
npm run dtslint
to updateindex.d.ts