File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed
packages/app/api-contracts/src/route-contract Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -52,18 +52,22 @@ type Exactly<T, U> = T & {
5252 [ K in keyof T ] : K extends keyof U ? T [ K ] : never
5353}
5454
55- type TypedPath < T extends z . ZodType | undefined > = {
56- requestPathParamsSchema ?: T
55+ type TypedPathRouteContract < T extends z . ZodType | undefined > = Omit <
56+ RouteContract ,
57+ 'pathResolver' | 'requestPathParamsSchema'
58+ > & {
5759 pathResolver : RoutePathResolver < InferSchemaOutput < T > >
60+ requestPathParamsSchema ?: T
5861}
5962
6063export const defineRouteContract = <
6164 PathParamsSchema extends z . ZodType | undefined ,
62- TypedPathContract extends Omit < RouteContract , 'pathResolver' > & TypedPath < PathParamsSchema > ,
63- const Contract extends TypedPathContract ,
65+ const Contract extends TypedPathRouteContract < PathParamsSchema > ,
6466> (
65- route : Exactly < Contract , TypedPathContract > & TypedPath < PathParamsSchema > ,
66- ) : Contract => route
67+ contract : Exactly < Contract , TypedPathRouteContract < PathParamsSchema > > & {
68+ requestPathParamsSchema ?: PathParamsSchema
69+ } ,
70+ ) : Contract => contract
6771
6872export const mapRouteContractToPath = ( routeConfig : RouteContract ) : string => {
6973 if ( ! routeConfig . requestPathParamsSchema ) {
You can’t perform that action at this time.
0 commit comments