You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
used the search to make sure that a similar issue hasn't already been submit
Expected Behavior
When typing my APIs, I noticed that I could type alias my TsoaResponse parameters since the same types are used in multiple routes.
exporttypeNotFound=TsoaResponse<404,{reason: "Thing does not exists"}>;
@Route("stuff")exportclassMyControllerextendsController{
@Patch("{id}")publicupdate(
@Path()id: number,
@Res()notExistsResponse: NotFound,): Promise<any>{// update thing ... returnnotExistsResponse(404,{reason: "Thing does not exists"});}
@Get("{id}")publicget(
@Path()id: number,
@Res()notExistsResponse: NotFound,): Promise<any>{// get thing ... returnnotExistsResponse(404,{reason: "Thing does not exists"});}}
Current Behavior
However, the Res decorator seems to limit this to the TsoaResponse type without accepting aliases or extended interfaces.
Generate routes error.
2024-08-27 16:27:11 [1] GenerateMetadataError: @Res() requires the type to be TsoaResponse<HTTPStatusCode, ResBody>
2024-08-27 16:27:11 [1] At: ...
Possible Solution
Let the Res decorator accept more types. Not sure how to do that since I am not that used to typescript.
Steps to Reproduce
See example above.
Context (Environment)
Version of the library: 6.4.0
Version of NodeJS: v20.12.2
Confirm you were using yarn not npm: [x]
Detailed Description
None
Breaking change?
Not sure
The text was updated successfully, but these errors were encountered:
Sorting
I'm submitting a ...
I confirm that I
Expected Behavior
When typing my APIs, I noticed that I could type alias my
TsoaResponse
parameters since the same types are used in multiple routes.Current Behavior
However, the
Res
decorator seems to limit this to theTsoaResponse
type without accepting aliases or extended interfaces.Possible Solution
Let the
Res
decorator accept more types. Not sure how to do that since I am not that used to typescript.Steps to Reproduce
See example above.
Context (Environment)
Version of the library: 6.4.0
Version of NodeJS: v20.12.2
Detailed Description
None
Breaking change?
Not sure
The text was updated successfully, but these errors were encountered: