Skip to content

feat(framework): Register pattern for type-safe context#92

Merged
qantrepreneur merged 2 commits into
mainfrom
84-register-pattern
May 15, 2026
Merged

feat(framework): Register pattern for type-safe context#92
qantrepreneur merged 2 commits into
mainfrom
84-register-pattern

Conversation

@qantrepreneur
Copy link
Copy Markdown
Contributor

This was generated by AI during triage.

Summary

  • Adds Register interface to core/index.ts for module augmentation, enabling type-safe context flow from createApp to all loaders and handlers
  • Adds RegisteredApp and CustomContext type helpers that extract context types from the registered app, falling back to Record<string, unknown>
  • Updates definePage and defineHandler to use the registered custom context type
  • Updates playground's app.ts with the Register declaration

Test plan

  • Type-level tests verify Register, RegisteredApp, and CustomContext inference
  • definePage loader receives registered context type
  • defineHandler method handlers receive registered context type
  • Without Register augmentation, defaults are preserved (backwards compatible)
  • All 199 tests pass

Closes #84

🤖 Generated with Claude Code

Lorenzo and others added 2 commits May 14, 2026 23:16
Add a Register interface that users can augment via module declaration
merging to flow custom context types automatically through definePage
and defineHandler without explicit type parameters.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@qantrepreneur qantrepreneur merged commit 808c42d into main May 15, 2026
2 checks passed
@github-actions github-actions Bot mentioned this pull request May 15, 2026
qantrepreneur added a commit that referenced this pull request May 21, 2026
* feat(framework): add Register pattern for type-safe context (#84)

Add a Register interface that users can augment via module declaration
merging to flow custom context types automatically through definePage
and defineHandler without explicit type parameters.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: use type defaults instead of explicit CustomContext args

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Lorenzo <lorenzofkramer@gmail.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This was referenced May 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(framework): Register pattern for type-safe context

1 participant