@@ -570,7 +570,10 @@ class Router {
570570 ) ;
571571 }
572572
573- #handleHttpMethod(
573+ #handleHttpMethod<
574+ TReqBody = never ,
575+ TResBody extends HandlerResponse = HandlerResponse
576+ > (
574577 method : HttpMethod ,
575578 path : Path ,
576579 middlewareOrHandler ?: Middleware [ ] | RouteHandler ,
@@ -635,13 +638,13 @@ class Router {
635638 ) : void ;
636639 public get ( path : Path ) : MethodDecorator ;
637640 public get ( path : Path , middleware : Middleware [ ] ) : MethodDecorator ;
638- public get (
641+ public get < TReqBody = never , TResBody extends HandlerResponse = HandlerResponse > (
639642 path : Path ,
640643 middlewareOrHandler ?: Middleware [ ] | RouteHandler ,
641644 handlerOrOptions ?: RouteHandler | Omit < HttpRouteOptions , 'method' | 'path' > ,
642645 options ?: Omit < HttpRouteOptions , 'method' | 'path' | 'middleware' >
643646 ) : MethodDecorator | undefined {
644- return this . #handleHttpMethod(
647+ return this . #handleHttpMethod< TReqBody , TResBody > (
645648 HttpVerbs . GET ,
646649 path ,
647650 middlewareOrHandler ,
@@ -663,13 +666,13 @@ class Router {
663666 ) : void ;
664667 public post ( path : Path ) : MethodDecorator ;
665668 public post ( path : Path , middleware : Middleware [ ] ) : MethodDecorator ;
666- public post (
669+ public post < TReqBody = never , TResBody extends HandlerResponse = HandlerResponse > (
667670 path : Path ,
668671 middlewareOrHandler ?: Middleware [ ] | RouteHandler ,
669672 handlerOrOptions ?: RouteHandler | Omit < HttpRouteOptions , 'method' | 'path' > ,
670673 options ?: Omit < HttpRouteOptions , 'method' | 'path' | 'middleware' >
671674 ) : MethodDecorator | undefined {
672- return this . #handleHttpMethod(
675+ return this . #handleHttpMethod< TReqBody , TResBody > (
673676 HttpVerbs . POST ,
674677 path ,
675678 middlewareOrHandler ,
@@ -691,13 +694,13 @@ class Router {
691694 ) : void ;
692695 public put ( path : Path ) : MethodDecorator ;
693696 public put ( path : Path , middleware : Middleware [ ] ) : MethodDecorator ;
694- public put (
697+ public put < TReqBody = never , TResBody extends HandlerResponse = HandlerResponse > (
695698 path : Path ,
696699 middlewareOrHandler ?: Middleware [ ] | RouteHandler ,
697700 handlerOrOptions ?: RouteHandler | Omit < HttpRouteOptions , 'method' | 'path' > ,
698701 options ?: Omit < HttpRouteOptions , 'method' | 'path' | 'middleware' >
699702 ) : MethodDecorator | undefined {
700- return this . #handleHttpMethod(
703+ return this . #handleHttpMethod< TReqBody , TResBody > (
701704 HttpVerbs . PUT ,
702705 path ,
703706 middlewareOrHandler ,
@@ -719,13 +722,13 @@ class Router {
719722 ) : void ;
720723 public patch ( path : Path ) : MethodDecorator ;
721724 public patch ( path : Path , middleware : Middleware [ ] ) : MethodDecorator ;
722- public patch (
725+ public patch < TReqBody = never , TResBody extends HandlerResponse = HandlerResponse > (
723726 path : Path ,
724727 middlewareOrHandler ?: Middleware [ ] | RouteHandler ,
725728 handlerOrOptions ?: RouteHandler | Omit < HttpRouteOptions , 'method' | 'path' > ,
726729 options ?: Omit < HttpRouteOptions , 'method' | 'path' | 'middleware' >
727730 ) : MethodDecorator | undefined {
728- return this . #handleHttpMethod(
731+ return this . #handleHttpMethod< TReqBody , TResBody > (
729732 HttpVerbs . PATCH ,
730733 path ,
731734 middlewareOrHandler ,
@@ -747,13 +750,13 @@ class Router {
747750 ) : void ;
748751 public delete ( path : Path ) : MethodDecorator ;
749752 public delete ( path : Path , middleware : Middleware [ ] ) : MethodDecorator ;
750- public delete (
753+ public delete < TReqBody = never , TResBody extends HandlerResponse = HandlerResponse > (
751754 path : Path ,
752755 middlewareOrHandler ?: Middleware [ ] | RouteHandler ,
753756 handlerOrOptions ?: RouteHandler | Omit < HttpRouteOptions , 'method' | 'path' > ,
754757 options ?: Omit < HttpRouteOptions , 'method' | 'path' | 'middleware' >
755758 ) : MethodDecorator | undefined {
756- return this . #handleHttpMethod(
759+ return this . #handleHttpMethod< TReqBody , TResBody > (
757760 HttpVerbs . DELETE ,
758761 path ,
759762 middlewareOrHandler ,
@@ -775,13 +778,13 @@ class Router {
775778 ) : void ;
776779 public head ( path : Path ) : MethodDecorator ;
777780 public head ( path : Path , middleware : Middleware [ ] ) : MethodDecorator ;
778- public head (
781+ public head < TReqBody = never , TResBody extends HandlerResponse = HandlerResponse > (
779782 path : Path ,
780783 middlewareOrHandler ?: Middleware [ ] | RouteHandler ,
781784 handlerOrOptions ?: RouteHandler | Omit < HttpRouteOptions , 'method' | 'path' > ,
782785 options ?: Omit < HttpRouteOptions , 'method' | 'path' | 'middleware' >
783786 ) : MethodDecorator | undefined {
784- return this . #handleHttpMethod(
787+ return this . #handleHttpMethod< TReqBody , TResBody > (
785788 HttpVerbs . HEAD ,
786789 path ,
787790 middlewareOrHandler ,
@@ -803,13 +806,13 @@ class Router {
803806 ) : void ;
804807 public options ( path : Path ) : MethodDecorator ;
805808 public options ( path : Path , middleware : Middleware [ ] ) : MethodDecorator ;
806- public options (
809+ public options < TReqBody = never , TResBody extends HandlerResponse = HandlerResponse > (
807810 path : Path ,
808811 middlewareOrHandler ?: Middleware [ ] | RouteHandler ,
809812 handlerOrOptions ?: RouteHandler | Omit < HttpRouteOptions , 'method' | 'path' > ,
810813 options ?: Omit < HttpRouteOptions , 'method' | 'path' | 'middleware' >
811814 ) : MethodDecorator | undefined {
812- return this . #handleHttpMethod(
815+ return this . #handleHttpMethod< TReqBody , TResBody > (
813816 HttpVerbs . OPTIONS ,
814817 path ,
815818 middlewareOrHandler ,
0 commit comments