Typed events functionality implemented, tested, and documented#20
Merged
mandla-enkosi merged 5 commits intomainfrom Mar 4, 2026
Merged
Typed events functionality implemented, tested, and documented#20mandla-enkosi merged 5 commits intomainfrom
mandla-enkosi merged 5 commits intomainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Implements “typed events” support for Trackkit’s factory API by introducing an event map generic that constrains track() calls at compile time, and adds accompanying tests + documentation.
Changes:
- Add
EventMap/AnyEventMaptypes and thread a genericEthroughcreateAnalytics,AnalyticsFacade, andAnalyticsInstance.track(). - Add runtime tests for typed vs untyped instances, plus compile-time (
.test-d.ts) type tests. - Update README + docs (Quickstart + API reference) to document typed events usage.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/trackkit/vitest.config.ts | Adds Vitest typecheck configuration for .test-d.ts files. |
| packages/trackkit/test/unit/types/typed-events.test-d.ts | Adds compile-time assertions for typed-events constraints. |
| packages/trackkit/test/unit/facade/typed-events.test.ts | Adds runtime verification that typed generics don’t affect runtime dispatch. |
| packages/trackkit/src/types.ts | Introduces EventMap/AnyEventMap and generic AnalyticsInstance<E> w/ typed track(). |
| packages/trackkit/src/factory.ts | Makes createAnalytics generic and returns a typed facade instance. |
| packages/trackkit/src/facade/index.ts | Makes AnalyticsFacade generic and types its track() method by event map. |
| packages/trackkit/README.md | Documents how to use typed events with createAnalytics<E>(). |
| docs/reference/api.md | Updates API reference to mention typed events and new default type param. |
| docs/overview/quickstart.md | Adds a “Typed events” section and links to API details. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
* Made doc fixes * Separation of dispatcher and consent config params --------- Authored-by: mandlamoyo <mandla.moyo@hotmail.com>
…ckkit into typed-events
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Implements “typed events” support for Trackkit’s factory API by introducing an event map generic that constrains track() calls at compile time, and adds accompanying tests + documentation.
Changes:
EventMap/AnyEventMaptypes and thread a genericEthroughcreateAnalytics,AnalyticsFacade, andAnalyticsInstance.track()..test-d.ts) type tests.