@@ -578,11 +578,11 @@ class Router {
578578 #handleHttpMethod< TReqBody = never , TResBody extends HandlerResponse = HandlerResponse > (
579579 method : HttpMethod ,
580580 path : Path ,
581- middlewareOrHandler ?: Middleware [ ] | RouteHandler ,
582- handlerOrOptions ?: RouteHandler | TypedRouteHandler < TReqBody , TResBody > ,
581+ middlewareOrHandler ?: Middleware [ ] | RouteHandler | TypedRouteHandler < TReqBody , TResBody > ,
582+ handlerOrOptions ?: RouteHandler | TypedRouteHandler < TReqBody , TResBody > | { validation : ValidationConfig < TReqBody , TResBody > } ,
583583 options ?: { validation : ValidationConfig < TReqBody , TResBody > }
584584 ) : MethodDecorator | undefined {
585- // Case 1: post (path, [middleware], handler, { validation })
585+ // Case 1: method (path, [middleware], handler, { validation })
586586 if ( Array . isArray ( middlewareOrHandler ) ) {
587587 if ( handlerOrOptions && typeof handlerOrOptions === 'function' ) {
588588 this . route ( handlerOrOptions , {
@@ -604,7 +604,7 @@ class Router {
604604 } ;
605605 }
606606
607- // Case 2: post (path, handler, { validation })
607+ // Case 2: method (path, handler, { validation }) or method(path, handler )
608608 if ( middlewareOrHandler && typeof middlewareOrHandler === 'function' ) {
609609 // Check if handlerOrOptions is an options object (not a function)
610610 if (
@@ -638,6 +638,11 @@ class Router {
638638 ) : void ;
639639 public get ( path : Path ) : MethodDecorator ;
640640 public get ( path : Path , middleware : Middleware [ ] ) : MethodDecorator ;
641+ public get < TReqBody = never , TResBody extends HandlerResponse = HandlerResponse > (
642+ path : Path ,
643+ handler : TypedRouteHandler < TReqBody , TResBody > ,
644+ options : { validation : ValidationConfig < TReqBody , TResBody > }
645+ ) : void ;
641646 public get < TReqBody = never , TResBody extends HandlerResponse = HandlerResponse > (
642647 path : Path ,
643648 middleware : Middleware [ ] ,
@@ -646,43 +651,46 @@ class Router {
646651 ) : void ;
647652 public get < TReqBody = never , TResBody extends HandlerResponse = HandlerResponse > (
648653 path : Path ,
649- middlewareOrHandler ?: Middleware [ ] | RouteHandler ,
650- handler ?: RouteHandler | TypedRouteHandler < TReqBody , TResBody > ,
654+ middlewareOrHandler ?: Middleware [ ] | RouteHandler | TypedRouteHandler < TReqBody , TResBody > ,
655+ handlerOrOptions ?: RouteHandler | TypedRouteHandler < TReqBody , TResBody > | { validation : ValidationConfig < TReqBody , TResBody > } ,
651656 options ?: { validation : ValidationConfig < TReqBody , TResBody > }
652657 ) : MethodDecorator | undefined {
653658 return this . #handleHttpMethod< TReqBody , TResBody > (
654659 HttpVerbs . GET ,
655660 path ,
656661 middlewareOrHandler ,
657- handler ,
662+ handlerOrOptions ,
658663 options
659664 ) ;
660665 }
661666
662667 public post (
663668 path : Path ,
664669 handler : RouteHandler ,
665- options ?: Omit < HttpRouteOptions , 'method' | 'path' >
666670 ) : void ;
667671 public post (
668672 path : Path ,
669673 middleware : Middleware [ ] ,
670674 handler : RouteHandler ,
671- options ?: Omit < HttpRouteOptions , 'method' | 'path' | 'middleware' >
672675 ) : void ;
673676 public post ( path : Path ) : MethodDecorator ;
674677 public post ( path : Path , middleware : Middleware [ ] ) : MethodDecorator ;
675678 public post < TReqBody = never , TResBody extends HandlerResponse = HandlerResponse > (
676679 path : Path ,
677- middlewareOrHandler ?: Middleware [ ] | RouteHandler ,
678- handlerOrOptions ?: RouteHandler | Omit < HttpRouteOptions , 'method' | 'path' > ,
679- options ?: Omit < HttpRouteOptions , 'method' | 'path' | 'middleware' >
680- ) : MethodDecorator | undefined ;
680+ handler : TypedRouteHandler < TReqBody , TResBody > ,
681+ options : { validation : ValidationConfig < TReqBody , TResBody > }
682+ ) : void ;
681683 public post < TReqBody = never , TResBody extends HandlerResponse = HandlerResponse > (
682684 path : Path ,
683- middlewareOrHandler ?: Middleware [ ] | RouteHandler ,
684- handlerOrOptions ?: RouteHandler | Omit < HttpRouteOptions , 'method' | 'path' > ,
685- options ?: Omit < HttpRouteOptions , 'method' | 'path' | 'middleware' >
685+ middleware : Middleware [ ] ,
686+ handler : TypedRouteHandler < TReqBody , TResBody > ,
687+ options : { validation : ValidationConfig < TReqBody , TResBody > }
688+ ) : void ;
689+ public post < TReqBody = never , TResBody extends HandlerResponse = HandlerResponse > (
690+ path : Path ,
691+ middlewareOrHandler ?: Middleware [ ] | RouteHandler | TypedRouteHandler < TReqBody , TResBody > ,
692+ handlerOrOptions ?: RouteHandler | TypedRouteHandler < TReqBody , TResBody > | { validation : ValidationConfig < TReqBody , TResBody > } ,
693+ options ?: { validation : ValidationConfig < TReqBody , TResBody > }
686694 ) : MethodDecorator | undefined {
687695 return this . #handleHttpMethod< TReqBody , TResBody > (
688696 HttpVerbs . POST ,
@@ -696,21 +704,30 @@ class Router {
696704 public put (
697705 path : Path ,
698706 handler : RouteHandler ,
699- options ?: Omit < HttpRouteOptions , 'method' | 'path' >
700707 ) : void ;
701708 public put (
702709 path : Path ,
703710 middleware : Middleware [ ] ,
704711 handler : RouteHandler ,
705- options ?: Omit < HttpRouteOptions , 'method' | 'path' | 'middleware' >
706712 ) : void ;
707713 public put ( path : Path ) : MethodDecorator ;
708714 public put ( path : Path , middleware : Middleware [ ] ) : MethodDecorator ;
709715 public put < TReqBody = never , TResBody extends HandlerResponse = HandlerResponse > (
710716 path : Path ,
711- middlewareOrHandler ?: Middleware [ ] | RouteHandler ,
712- handlerOrOptions ?: RouteHandler | Omit < HttpRouteOptions , 'method' | 'path' > ,
713- options ?: Omit < HttpRouteOptions , 'method' | 'path' | 'middleware' >
717+ handler : TypedRouteHandler < TReqBody , TResBody > ,
718+ options : { validation : ValidationConfig < TReqBody , TResBody > }
719+ ) : void ;
720+ public put < TReqBody = never , TResBody extends HandlerResponse = HandlerResponse > (
721+ path : Path ,
722+ middleware : Middleware [ ] ,
723+ handler : TypedRouteHandler < TReqBody , TResBody > ,
724+ options : { validation : ValidationConfig < TReqBody , TResBody > }
725+ ) : void ;
726+ public put < TReqBody = never , TResBody extends HandlerResponse = HandlerResponse > (
727+ path : Path ,
728+ middlewareOrHandler ?: Middleware [ ] | RouteHandler | TypedRouteHandler < TReqBody , TResBody > ,
729+ handlerOrOptions ?: RouteHandler | TypedRouteHandler < TReqBody , TResBody > | { validation : ValidationConfig < TReqBody , TResBody > } ,
730+ options ?: { validation : ValidationConfig < TReqBody , TResBody > }
714731 ) : MethodDecorator | undefined {
715732 return this . #handleHttpMethod< TReqBody , TResBody > (
716733 HttpVerbs . PUT ,
@@ -724,21 +741,30 @@ class Router {
724741 public patch (
725742 path : Path ,
726743 handler : RouteHandler ,
727- options ?: Omit < HttpRouteOptions , 'method' | 'path' >
728744 ) : void ;
729745 public patch (
730746 path : Path ,
731747 middleware : Middleware [ ] ,
732748 handler : RouteHandler ,
733- options ?: Omit < HttpRouteOptions , 'method' | 'path' | 'middleware' >
734749 ) : void ;
735750 public patch ( path : Path ) : MethodDecorator ;
736751 public patch ( path : Path , middleware : Middleware [ ] ) : MethodDecorator ;
737752 public patch < TReqBody = never , TResBody extends HandlerResponse = HandlerResponse > (
738753 path : Path ,
739- middlewareOrHandler ?: Middleware [ ] | RouteHandler ,
740- handlerOrOptions ?: RouteHandler | Omit < HttpRouteOptions , 'method' | 'path' > ,
741- options ?: Omit < HttpRouteOptions , 'method' | 'path' | 'middleware' >
754+ handler : TypedRouteHandler < TReqBody , TResBody > ,
755+ options : { validation : ValidationConfig < TReqBody , TResBody > }
756+ ) : void ;
757+ public patch < TReqBody = never , TResBody extends HandlerResponse = HandlerResponse > (
758+ path : Path ,
759+ middleware : Middleware [ ] ,
760+ handler : TypedRouteHandler < TReqBody , TResBody > ,
761+ options : { validation : ValidationConfig < TReqBody , TResBody > }
762+ ) : void ;
763+ public patch < TReqBody = never , TResBody extends HandlerResponse = HandlerResponse > (
764+ path : Path ,
765+ middlewareOrHandler ?: Middleware [ ] | RouteHandler | TypedRouteHandler < TReqBody , TResBody > ,
766+ handlerOrOptions ?: RouteHandler | TypedRouteHandler < TReqBody , TResBody > | { validation : ValidationConfig < TReqBody , TResBody > } ,
767+ options ?: { validation : ValidationConfig < TReqBody , TResBody > }
742768 ) : MethodDecorator | undefined {
743769 return this . #handleHttpMethod< TReqBody , TResBody > (
744770 HttpVerbs . PATCH ,
@@ -752,21 +778,30 @@ class Router {
752778 public delete (
753779 path : Path ,
754780 handler : RouteHandler ,
755- options ?: Omit < HttpRouteOptions , 'method' | 'path' >
756781 ) : void ;
757782 public delete (
758783 path : Path ,
759784 middleware : Middleware [ ] ,
760785 handler : RouteHandler ,
761- options ?: Omit < HttpRouteOptions , 'method' | 'path' | 'middleware' >
762786 ) : void ;
763787 public delete ( path : Path ) : MethodDecorator ;
764788 public delete ( path : Path , middleware : Middleware [ ] ) : MethodDecorator ;
765789 public delete < TReqBody = never , TResBody extends HandlerResponse = HandlerResponse > (
766790 path : Path ,
767- middlewareOrHandler ?: Middleware [ ] | RouteHandler ,
768- handlerOrOptions ?: RouteHandler | Omit < HttpRouteOptions , 'method' | 'path' > ,
769- options ?: Omit < HttpRouteOptions , 'method' | 'path' | 'middleware' >
791+ handler : TypedRouteHandler < TReqBody , TResBody > ,
792+ options : { validation : ValidationConfig < TReqBody , TResBody > }
793+ ) : void ;
794+ public delete < TReqBody = never , TResBody extends HandlerResponse = HandlerResponse > (
795+ path : Path ,
796+ middleware : Middleware [ ] ,
797+ handler : TypedRouteHandler < TReqBody , TResBody > ,
798+ options : { validation : ValidationConfig < TReqBody , TResBody > }
799+ ) : void ;
800+ public delete < TReqBody = never , TResBody extends HandlerResponse = HandlerResponse > (
801+ path : Path ,
802+ middlewareOrHandler ?: Middleware [ ] | RouteHandler | TypedRouteHandler < TReqBody , TResBody > ,
803+ handlerOrOptions ?: RouteHandler | TypedRouteHandler < TReqBody , TResBody > | { validation : ValidationConfig < TReqBody , TResBody > } ,
804+ options ?: { validation : ValidationConfig < TReqBody , TResBody > }
770805 ) : MethodDecorator | undefined {
771806 return this . #handleHttpMethod< TReqBody , TResBody > (
772807 HttpVerbs . DELETE ,
@@ -780,21 +815,30 @@ class Router {
780815 public head (
781816 path : Path ,
782817 handler : RouteHandler ,
783- options ?: Omit < HttpRouteOptions , 'method' | 'path' >
784818 ) : void ;
785819 public head (
786820 path : Path ,
787821 middleware : Middleware [ ] ,
788822 handler : RouteHandler ,
789- options ?: Omit < HttpRouteOptions , 'method' | 'path' | 'middleware' >
790823 ) : void ;
791824 public head ( path : Path ) : MethodDecorator ;
792825 public head ( path : Path , middleware : Middleware [ ] ) : MethodDecorator ;
793826 public head < TReqBody = never , TResBody extends HandlerResponse = HandlerResponse > (
794827 path : Path ,
795- middlewareOrHandler ?: Middleware [ ] | RouteHandler ,
796- handlerOrOptions ?: RouteHandler | Omit < HttpRouteOptions , 'method' | 'path' > ,
797- options ?: Omit < HttpRouteOptions , 'method' | 'path' | 'middleware' >
828+ handler : TypedRouteHandler < TReqBody , TResBody > ,
829+ options : { validation : ValidationConfig < TReqBody , TResBody > }
830+ ) : void ;
831+ public head < TReqBody = never , TResBody extends HandlerResponse = HandlerResponse > (
832+ path : Path ,
833+ middleware : Middleware [ ] ,
834+ handler : TypedRouteHandler < TReqBody , TResBody > ,
835+ options : { validation : ValidationConfig < TReqBody , TResBody > }
836+ ) : void ;
837+ public head < TReqBody = never , TResBody extends HandlerResponse = HandlerResponse > (
838+ path : Path ,
839+ middlewareOrHandler ?: Middleware [ ] | RouteHandler | TypedRouteHandler < TReqBody , TResBody > ,
840+ handlerOrOptions ?: RouteHandler | TypedRouteHandler < TReqBody , TResBody > | { validation : ValidationConfig < TReqBody , TResBody > } ,
841+ options ?: { validation : ValidationConfig < TReqBody , TResBody > }
798842 ) : MethodDecorator | undefined {
799843 return this . #handleHttpMethod< TReqBody , TResBody > (
800844 HttpVerbs . HEAD ,
@@ -808,21 +852,30 @@ class Router {
808852 public options (
809853 path : Path ,
810854 handler : RouteHandler ,
811- options ?: Omit < HttpRouteOptions , 'method' | 'path' >
812855 ) : void ;
813856 public options (
814857 path : Path ,
815858 middleware : Middleware [ ] ,
816859 handler : RouteHandler ,
817- options ?: Omit < HttpRouteOptions , 'method' | 'path' | 'middleware' >
818860 ) : void ;
819861 public options ( path : Path ) : MethodDecorator ;
820862 public options ( path : Path , middleware : Middleware [ ] ) : MethodDecorator ;
821863 public options < TReqBody = never , TResBody extends HandlerResponse = HandlerResponse > (
822864 path : Path ,
823- middlewareOrHandler ?: Middleware [ ] | RouteHandler ,
824- handlerOrOptions ?: RouteHandler | Omit < HttpRouteOptions , 'method' | 'path' > ,
825- options ?: Omit < HttpRouteOptions , 'method' | 'path' | 'middleware' >
865+ handler : TypedRouteHandler < TReqBody , TResBody > ,
866+ options : { validation : ValidationConfig < TReqBody , TResBody > }
867+ ) : void ;
868+ public options < TReqBody = never , TResBody extends HandlerResponse = HandlerResponse > (
869+ path : Path ,
870+ middleware : Middleware [ ] ,
871+ handler : TypedRouteHandler < TReqBody , TResBody > ,
872+ options : { validation : ValidationConfig < TReqBody , TResBody > }
873+ ) : void ;
874+ public options < TReqBody = never , TResBody extends HandlerResponse = HandlerResponse > (
875+ path : Path ,
876+ middlewareOrHandler ?: Middleware [ ] | RouteHandler | TypedRouteHandler < TReqBody , TResBody > ,
877+ handlerOrOptions ?: RouteHandler | TypedRouteHandler < TReqBody , TResBody > | { validation : ValidationConfig < TReqBody , TResBody > } ,
878+ options ?: { validation : ValidationConfig < TReqBody , TResBody > }
826879 ) : MethodDecorator | undefined {
827880 return this . #handleHttpMethod< TReqBody , TResBody > (
828881 HttpVerbs . OPTIONS ,
0 commit comments