diff --git a/package.json b/package.json index beb75d3..9fe384b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@btst/yar", - "version": "1.1.0", + "version": "1.1.1", "packageManager": "pnpm@10.14.0", "description": "Pluggable router for modern react frameworks", "type": "module", diff --git a/src/router.ts b/src/router.ts index e9e43be..3ff2eae 100644 --- a/src/router.ts +++ b/src/router.ts @@ -104,16 +104,13 @@ type ExtractRouteReturn = R extends (...args: any[]) => infer Return ? Return : never; -// Helper type to get the union of all route return types -type InferRouteReturnTypes> = { - [K in keyof Routes]: ExtractRouteReturn; -}[keyof Routes]; - -// The return type for getRoute, combining the handler return with params -type GetRouteReturn> = - InferRouteReturnTypes & { +// The return type for getRoute, combining each handler return with params +// We distribute the intersection over the union to preserve all properties +type GetRouteReturn> = { + [K in keyof Routes]: ExtractRouteReturn & { params: Record; }; +}[keyof Routes]; /** * Creates a router instance from a collection of routes.