File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -410,7 +410,7 @@ describe("Types", () => {
410410 expectTypeOf < Actual > ( ) . toMatchObjectType < Expected > ( ) ;
411411 } ) ;
412412
413- it ( "should some base parameters for all handlers" , ( ) => {
413+ it ( "should include some base parameters for all handlers" , ( ) => {
414414 type Path = "/api" ;
415415 type Def = t . AnyDef ;
416416 type Ctx = { a : "A" } ;
@@ -432,6 +432,39 @@ describe("Types", () => {
432432 type Actual = t . BuildHandlerContext < App , Path , Def > ;
433433 expectTypeOf < Actual > ( ) . toMatchObjectType < Expected > ( ) ;
434434 } ) ;
435+
436+ it ( "should build input params correctly" , ( ) => {
437+ type Path = "/api" ;
438+ type Def = {
439+ body : z . ZodObject < { body : z . ZodString } > ;
440+ query : z . ZodObject < { query : z . ZodNumber } > ;
441+ params : z . ZodObject < { params : z . ZodBoolean } > ;
442+ responses : {
443+ 404 : ErrorResponse ;
444+ } ;
445+ } ;
446+ type Ctx = { a : "A" } ;
447+ type App = {
448+ prefix : "" ;
449+ exported : false ;
450+ ctx : Ctx ;
451+ routes : {
452+ GET : {
453+ [ p in Path ] : Def ;
454+ } ;
455+ } ;
456+ } ;
457+ type Expected = {
458+ route : Path ;
459+ request : Request ;
460+ body : { body : string } ;
461+ query : { query : number } ;
462+ params : { params : boolean } ;
463+ } ;
464+
465+ type Actual = t . BuildHandlerContext < App , Path , Def > ;
466+ expectTypeOf < Actual > ( ) . toMatchObjectType < Expected > ( ) ;
467+ } ) ;
435468 } ) ;
436469
437470 describe ( "ApplyAppPrefix" , ( ) => {
Original file line number Diff line number Diff line change @@ -751,7 +751,10 @@ export type BuildHandlerContext<
751751 TPath extends BasePath ,
752752 TRouteDef extends RouteDef ,
753753> = Simplify <
754- OnBeforeHandleContext < GetAppDataCtx < TAppData > > & {
754+ Omit <
755+ OnBeforeHandleContext < GetAppDataCtx < TAppData > > ,
756+ "body" | "query" | "params" | "headers"
757+ > & {
755758 route : TPath ;
756759 } & GetRequestParamsOutputFromDef < TRouteDef > & {
757760 status : StatusFn < GetResponseStatusMap < TRouteDef > > ;
You can’t perform that action at this time.
0 commit comments