Skip to content

Commit d141746

Browse files
committed
refactor: method decorators
1 parent 4749590 commit d141746

File tree

6 files changed

+17
-17
lines changed

6 files changed

+17
-17
lines changed

packages/runtime/src/decorators/methods.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,40 @@
1-
export function Options(value?: string): Function {
1+
export function Options(value?: string): MethodDecorator {
22
return () => {
33
return;
44
};
55
}
66

7-
export function Get(value?: string): Function {
7+
export function Get(value?: string): MethodDecorator {
88
return () => {
99
return;
1010
};
1111
}
1212

13-
export function Post(value?: string): Function {
13+
export function Post(value?: string): MethodDecorator {
1414
return () => {
1515
return;
1616
};
1717
}
1818

19-
export function Put(value?: string): Function {
19+
export function Put(value?: string): MethodDecorator {
2020
return () => {
2121
return;
2222
};
2323
}
2424

25-
export function Patch(value?: string): Function {
25+
export function Patch(value?: string): MethodDecorator {
2626
return () => {
2727
return;
2828
};
2929
}
3030

31-
export function Delete(value?: string): Function {
31+
export function Delete(value?: string): MethodDecorator {
3232
return () => {
3333
return;
3434
};
3535
}
3636

37-
export function Head(value?: string): Function {
37+
export function Head(value?: string): MethodDecorator {
3838
return () => {
3939
return;
4040
};

packages/runtime/src/decorators/operationid.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export function OperationId(value: string): Function {
1+
export function OperationId(value: string): MethodDecorator {
22
return () => {
33
return;
44
};

packages/runtime/src/decorators/response.ts

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

4-
export function SuccessResponse<HeaderType extends IsValidHeader<HeaderType> = object>(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[]): MethodDecorator {
55
return () => {
66
return;
77
};
@@ -12,7 +12,7 @@ export function Response<ExampleType, HeaderType extends IsValidHeader<HeaderTyp
1212
description?: string,
1313
example?: ExampleType,
1414
produces?: string | string[],
15-
): Function {
15+
): MethodDecorator {
1616
return () => {
1717
return;
1818
};
@@ -23,7 +23,7 @@ export function Response<ExampleType, HeaderType extends IsValidHeader<HeaderTyp
2323
*
2424
* The type of the responder function should be annotated `TsoaResponse<Status, Data, Headers>` in order to support OpenAPI documentation.
2525
*/
26-
export function Res(): Function {
26+
export function Res(): ParameterDecorator {
2727
return () => {
2828
return;
2929
};
@@ -35,7 +35,7 @@ export function Res(): Function {
3535
*
3636
* @link https://swagger.io/docs/specification/media-types/
3737
*/
38-
export function Produces(value: string): Function {
38+
export function Produces(value: string): MethodDecorator {
3939
return () => {
4040
return;
4141
};

packages/runtime/src/decorators/route.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export function Route(name?: string): Function {
1+
export function Route(name?: string): ClassDecorator {
22
return () => {
33
return;
44
};
@@ -7,7 +7,7 @@ export function Route(name?: string): Function {
77
/**
88
* can be used to entirely hide an method from documentation
99
*/
10-
export function Hidden(): Function {
10+
export function Hidden(): ClassDecorator & MethodDecorator {
1111
return () => {
1212
return;
1313
};

packages/runtime/src/decorators/security.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* Can be used to indicate that a method requires no security.
33
*/
4-
export function NoSecurity(): Function {
4+
export function NoSecurity(): ClassDecorator & MethodDecorator {
55
return () => {
66
return;
77
};
@@ -10,7 +10,7 @@ export function NoSecurity(): Function {
1010
/**
1111
* @param {name} security name from securityDefinitions
1212
*/
13-
export function Security(name: string | { [name: string]: string[] }, scopes?: string[]): Function {
13+
export function Security(name: string | { [name: string]: string[] }, scopes?: string[]): ClassDecorator & MethodDecorator {
1414
return () => {
1515
return;
1616
};

packages/runtime/src/decorators/tags.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export function Tags(...values: string[]): Function {
1+
export function Tags(...values: string[]): MethodDecorator {
22
return () => {
33
return;
44
};

0 commit comments

Comments
 (0)