Skip to content

Commit 6427660

Browse files
committed
fix(server): InferRouterInputs & InferRouterOutputs not work with lazy router
1 parent a055cad commit 6427660

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

packages/server/src/router.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,15 +82,19 @@ export function toContractRouter(
8282
}
8383

8484
export type InferRouterInputs<T extends Router<any>> = {
85-
[K in keyof T]: T[K] extends Procedure<any, any, infer UInputSchema, any, any>
85+
[K in keyof T]: T[K] extends
86+
| Procedure<any, any, infer UInputSchema, any, any>
87+
| Lazy<Procedure<any, any, infer UInputSchema, any, any>>
8688
? SchemaInput<UInputSchema>
8789
: T[K] extends Router<any>
8890
? InferRouterInputs<T[K]>
8991
: never
9092
}
9193

9294
export type InferRouterOutputs<T extends Router<any>> = {
93-
[K in keyof T]: T[K] extends Procedure<any, any, any, infer UOutputSchema, infer UFuncOutput>
95+
[K in keyof T]: T[K] extends
96+
| Procedure<any, any, any, infer UOutputSchema, infer UFuncOutput>
97+
| Lazy<Procedure<any, any, any, infer UOutputSchema, infer UFuncOutput>>
9498
? SchemaOutput<UOutputSchema, UFuncOutput>
9599
: T[K] extends Router<any>
96100
? InferRouterOutputs<T[K]>

0 commit comments

Comments
 (0)