Skip to content

Conversation

@uhyo
Copy link
Owner

@uhyo uhyo commented Jan 24, 2026

Summary

  • Add RouteComponentPropsOf<T> utility type that extracts component props from a route definition
  • This allows users to type their route components like:
    type Props = RouteComponentPropsOf<typeof userRoute>;
    function UserPage({ params, data }: Props) { ... }
  • Change OpaqueRouteDefinition symbol type from never to unknown for better type discrimination
  • Add type constraint so using with non-typeful routes produces a compile error (not silent never)

Test plan

  • pnpm typecheck passes
  • pnpm test:run passes (155 tests including 28 type tests)
  • Documentation updated (ApiTypesPage and LearnTypeSafetyPage)

🤖 Generated with Claude Code

Add a utility type that extracts component props from a route definition,
allowing users to type their route components more easily:

  type Props = RouteComponentPropsOf<typeof userRoute>;

Changes:
- Add RouteComponentPropsOf type to route.ts
- Change OpaqueRouteDefinition symbol from `never` to `unknown` for better type discrimination
- Add type constraint to reject non-typeful routes at compile time
- Export RouteComponentPropsOf from index.ts
- Add comprehensive type tests
- Update documentation (ApiTypesPage and LearnTypeSafetyPage)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@uhyo uhyo merged commit 42dc815 into master Jan 24, 2026
1 check passed
@uhyo uhyo deleted the feat/component-props branch January 24, 2026 05:55
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.

2 participants