Skip to content

Commit 553cab3

Browse files
committed
{} object
1 parent 9fd40e4 commit 553cab3

File tree

8 files changed

+12
-12
lines changed

8 files changed

+12
-12
lines changed

packages/runtime/src/decorators/middlewares.ts

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

55
const TSOA_MIDDLEWARES = Symbol('@tsoa:middlewares');
66

@@ -34,7 +34,7 @@ function decorator(fn: (value: any) => void) {
3434
* @param middlewares
3535
* @returns
3636
*/
37-
export function Middlewares<T extends Function | Object>(...mws: Array<Middleware<T>>): ClassDecorator & MethodDecorator {
37+
export function Middlewares<T extends Function | object>(...mws: Array<Middleware<T>>): ClassDecorator & MethodDecorator {
3838
return decorator(target => {
3939
if (mws) {
4040
const current = fetchMiddlewares<T>(target);
@@ -49,6 +49,6 @@ export function Middlewares<T extends Function | Object>(...mws: Array<Middlewar
4949
* @param target
5050
* @returns list of middlewares
5151
*/
52-
export function fetchMiddlewares<T extends Function | Object>(target: any): Array<Middleware<T>> {
52+
export function fetchMiddlewares<T extends Function | object>(target: any): Array<Middleware<T>> {
5353
return Reflect.getMetadata(TSOA_MIDDLEWARES, target) || [];
5454
}

packages/runtime/src/decorators/response.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import { IsValidHeader } from '../utils/isHeaderType';
22
import { HttpStatusCodeLiteral, HttpStatusCodeStringLiteral, OtherValidOpenApiHttpStatusCode } from '../interfaces/response';
33

4-
export function SuccessResponse<HeaderType extends IsValidHeader<HeaderType> = {}>(name: string | number, description?: string, produces?: string | string[]): Function {
4+
export function SuccessResponse<HeaderType extends IsValidHeader<HeaderType> = object>(name: string | number, description?: string, produces?: string | string[]): Function {
55
return () => {
66
return;
77
};
88
}
99

10-
export function Response<ExampleType, HeaderType extends IsValidHeader<HeaderType> = {}>(
10+
export function Response<ExampleType, HeaderType extends IsValidHeader<HeaderType> = object>(
1111
name: HttpStatusCodeLiteral | HttpStatusCodeStringLiteral | OtherValidOpenApiHttpStatusCode,
1212
description?: string,
1313
example?: ExampleType,

packages/runtime/src/interfaces/response.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,4 @@ export type HttpStatusCodeStringLiteral = `${HttpStatusCodeLiteral}`;
6565

6666
export type OtherValidOpenApiHttpStatusCode = '1XX' | '2XX' | '3XX' | '4XX' | '5XX' | 'default';
6767

68-
export type TsoaResponse<T extends HttpStatusCodeLiteral, BodyType, HeaderType extends IsValidHeader<HeaderType> = {}> = (status: T, data: BodyType, headers?: HeaderType) => any;
68+
export type TsoaResponse<T extends HttpStatusCodeLiteral, BodyType, HeaderType extends IsValidHeader<HeaderType> = object> = (status: T, data: BodyType, headers?: HeaderType) => any;

packages/runtime/src/routeGeneration/templates/express/expressTemplateService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { TemplateService } from '../templateService';
88

99
type ExpressApiHandlerParameters = {
1010
methodName: string;
11-
controller: Controller | Object;
11+
controller: Controller | object;
1212
response: ExResponse;
1313
next: ExNext;
1414
validatedArgs: any[];

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const hapiTsoaResponsed = Symbol('@tsoa:template_service:hapi:responsed');
1212

1313
type HapiApiHandlerParameters = {
1414
methodName: string;
15-
controller: Controller | Object;
15+
controller: Controller | object;
1616
h: HResponse;
1717
validatedArgs: any[];
1818
successStatus?: number;

packages/runtime/src/routeGeneration/templates/koa/koaTemplateService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const koaTsoaResponsed = Symbol('@tsoa:template_service:koa:is_responsed');
1010

1111
type KoaApiHandlerParameters = {
1212
methodName: string;
13-
controller: Controller | Object;
13+
controller: Controller | object;
1414
context: Context;
1515
validatedArgs: any[];
1616
successStatus?: number;

packages/runtime/src/routeGeneration/templates/templateService.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ export abstract class TemplateService<ApiHandlerParameters, ValidationArgsParame
1919

2020
protected abstract returnHandler(params: ReturnHandlerParameters): any;
2121

22-
protected isController(object: Controller | Object): object is Controller {
22+
protected isController(object: Controller | object): object is Controller {
2323
return 'getHeaders' in object && 'getStatus' in object && 'setStatus' in object;
2424
}
2525

26-
protected buildPromise(methodName: string, controller: Controller | Object, validatedArgs: any) {
26+
protected buildPromise(methodName: string, controller: Controller | object, validatedArgs: any) {
2727
const prototype = Object.getPrototypeOf(controller);
2828
const descriptor = Object.getOwnPropertyDescriptor(prototype, methodName);
2929
return descriptor!.value.apply(controller, validatedArgs);

packages/runtime/src/utils/isHeaderType.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
*/
55
export type IsValidHeader<Header> = keyof Header extends string | number
66
? Header[keyof Header] extends string | string[] | undefined
7-
? {}
7+
? object
88
: 'Header values must be string or string[]'
99
: 'Header names must be of type string';

0 commit comments

Comments
 (0)