@@ -3,6 +3,7 @@ import { ApiRoute, BaseApiRoute } from './base';
33import { BaseApiEndpoint , EndpointMethod } from './endpoint' ;
44
55export abstract class BaseApiRouter extends BaseApiRoute {
6+ override routeType = 'router' as const ;
67 protected router : ExpressRouter ;
78
89 public registeredRoutes : BaseApiRoute [ ] = [ ] ;
@@ -45,23 +46,25 @@ export abstract class BaseApiRouter extends BaseApiRoute {
4546 // Set parent relationship for authentication cascading
4647 instance . parentRoute = this ;
4748
48- if ( instance instanceof BaseApiEndpoint ) {
49- instance . tag = tag ;
49+ if ( instance . routeType === 'endpoint' ) {
50+ ( instance as BaseApiEndpoint ) . tag = tag ;
5051 }
5152
5253 await instance . register ( this . router , this . fullPath ) ;
5354
5455 this . registeredRoutes . push ( instance ) ;
5556
5657 // Track endpoint methods for 405 handling
57- if ( instance instanceof BaseApiEndpoint ) {
58+ if ( instance . routeType === 'endpoint' ) {
5859 const path = instance . path ;
5960
6061 if ( ! pathMethods . has ( path ) ) {
6162 pathMethods . set ( path , new Set ( ) ) ;
6263 }
6364
64- pathMethods . get ( path ) ! . add ( instance . method ) ;
65+ pathMethods
66+ . get ( path ) !
67+ . add ( ( instance as BaseApiEndpoint ) . method ) ;
6568 }
6669 }
6770
0 commit comments