-
Notifications
You must be signed in to change notification settings - Fork 277
Feature/event emitter/env #1669
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Feature/event emitter/env #1669
Conversation
🦋 Changeset detectedLatest commit: e5b2966 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1669 +/- ##
=======================================
Coverage 92.24% 92.24%
=======================================
Files 111 111
Lines 3661 3661
Branches 967 956 -11
=======================================
Hits 3377 3377
Misses 250 250
Partials 34 34
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| * @returns The event handler. | ||
| */ | ||
| export const defineHandler = < | ||
| EPMap extends EventPayloadMap, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having the EPMap extends EventPayloadMap constraint makes it difficult to type Emitter and EmitterEnv correctly due to the circular reference
|
@BarryThePenguin Thank you for the PR. Hey @DavidHavl, can you review this? |
|
@BarryThePenguin By introducing the |
DavidHavl
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- By introducing the EmitterEnv, you have created a circular reference, so that is not desired.
- Removing the EventPayloadMap constraint (which dictates that key needs to be a string) isn’t a solution because it disables autocompletion in some cases and introduces potential errors (the key can be anything). The constraint ensures type safety without creating coupling.
Introduces
EmitterEnvto simplifyContexttypes