Skip to content

Commit d78c344

Browse files
committed
refactor: callable functions
1 parent ed1e660 commit d78c344

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

packages/runtime/src/decorators/middlewares.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
/* eslint-disable @typescript-eslint/no-unsafe-argument */
2-
/* eslint-disable @typescript-eslint/no-explicit-any */
3-
type Middleware<T extends Function | object> = T;
1+
type Middleware<T extends CallableFunction | object> = T;
42

53
const TSOA_MIDDLEWARES = Symbol('@tsoa:middlewares');
64

@@ -34,7 +32,7 @@ function decorator(fn: (value: any) => void) {
3432
* @param middlewares
3533
* @returns
3634
*/
37-
export function Middlewares<T extends Function | object>(...mws: Array<Middleware<T>>): ClassDecorator & MethodDecorator {
35+
export function Middlewares<T extends CallableFunction | object>(...mws: Array<Middleware<T>>): ClassDecorator & MethodDecorator {
3836
return decorator(target => {
3937
if (mws) {
4038
const current = fetchMiddlewares<T>(target);
@@ -49,6 +47,6 @@ export function Middlewares<T extends Function | object>(...mws: Array<Middlewar
4947
* @param target
5048
* @returns list of middlewares
5149
*/
52-
export function fetchMiddlewares<T extends Function | object>(target: any): Array<Middleware<T>> {
50+
export function fetchMiddlewares<T extends CallableFunction | object>(target: any): Array<Middleware<T>> {
5351
return Reflect.getMetadata(TSOA_MIDDLEWARES, target) || [];
5452
}

packages/runtime/src/routeGeneration/templates/hapi/hapiTemplateService.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ export class HapiTemplateService extends TemplateService<HapiApiHandlerParameter
3636
protected readonly models: TsoaRoute.Models,
3737
protected readonly config: AdditionalProps,
3838
private readonly hapi: {
39-
boomify: Function;
40-
isBoom: Function;
39+
boomify: CallableFunction;
40+
isBoom: CallableFunction;
4141
},
4242
) {
4343
super(models, config);

0 commit comments

Comments
 (0)