Skip to content

Commit 773d062

Browse files
feature(core) add HttpServer typings
1 parent 1cac0a9 commit 773d062

2 files changed

Lines changed: 7 additions & 10 deletions

File tree

packages/core/router/router-explorer.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,16 @@ export class RouterExplorer {
5353
);
5454
}
5555

56-
public explore(
56+
public explore<T extends HttpServer = any>(
5757
instance: Controller,
5858
metatype: Type<Controller>,
5959
module: string,
60-
appInstance: any,
60+
applicationRef: T,
6161
basePath: string,
6262
) {
6363
const routerPaths = this.scanForPaths(instance);
6464
this.applyPathsToRouterProxy(
65-
appInstance,
65+
applicationRef,
6666
routerPaths,
6767
instance,
6868
module,

packages/core/router/routes-resolver.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,25 +36,22 @@ export class RoutesResolver implements Resolver {
3636
);
3737
}
3838

39-
public resolve<TApplication extends HttpServer>(
40-
appInstance: TApplication,
41-
basePath: string,
42-
) {
39+
public resolve<T extends HttpServer>(applicationRef: T, basePath: string) {
4340
const modules = this.container.getModules();
4441
modules.forEach(({ controllers, metatype }, moduleName) => {
4542
let path = metatype
4643
? Reflect.getMetadata(MODULE_PATH, metatype)
4744
: undefined;
4845
path = path ? path + basePath : basePath;
49-
this.registerRouters(controllers, moduleName, path, appInstance);
46+
this.registerRouters(controllers, moduleName, path, applicationRef);
5047
});
5148
}
5249

5350
public registerRouters(
5451
routes: Map<string, InstanceWrapper<Controller>>,
5552
moduleName: string,
5653
basePath: string,
57-
appInstance: HttpServer,
54+
applicationRef: HttpServer,
5855
) {
5956
routes.forEach(({ instance, metatype }) => {
6057
const path = this.routerBuilder.extractRouterPath(metatype, basePath);
@@ -65,7 +62,7 @@ export class RoutesResolver implements Resolver {
6562
instance,
6663
metatype,
6764
moduleName,
68-
appInstance,
65+
applicationRef,
6966
path,
7067
);
7168
});

0 commit comments

Comments
 (0)