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
I have a typescript error in my generated routes code.
Version: 4.0.35 works
Version: 4.17.21 has errors
Sorting
I'm submitting a ...
bug report
feature request
support request
I confirm that I
used the search to make sure that a similar issue hasn't already been submit
Expected Behavior
Generated code should be error free.
Current Behavior
No overload matches this call.
Overload 1 of 2, '(path: PathParams, ...handlers: RequestHandler[]): Router', gave the following error.
Argument of type 'RequestHandler<core.ParamsDictionary, any, any, core.Query, Record<string, any>>' is not assignable to parameter of type 'RequestHandler'.
Type 'RequestHandler<core.ParamsDictionary, any, any, core.Query, Record<string, any>>' provides no match for the signature '(req: Request, res: Response, next?: NextFunction | undefined): any'.
Overload 2 of 2, '(path: PathParams, ...handlers: RequestHandlerParams[]): Router', gave the following error.
Argument of type 'RequestHandler<core.ParamsDictionary, any, any, core.Query, Record<string, any>>' is not assignable to parameter of type 'RequestHandlerParams'.ts(2769)
on line 47, of the following generated code:
/* tslint:disable *//* eslint-disable */// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoaimport{TsoaRoute,fetchMiddlewares,ExpressTemplateService}from'@tsoa/runtime';// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoaimport{UsersController}from'./../../../src/users/user.controller';importtype{RequestasExRequest,ResponseasExResponse,RequestHandler,Router}from'express';// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoaconstmodels: TsoaRoute.Models={"User": {"dataType": "refObject","properties": {"id": {"dataType":"double","required":true},"email": {"dataType":"string","required":true},"name": {"dataType":"string","required":true},"status": {"dataType":"union","subSchemas":[{"dataType":"enum","enums":["Happy"]},{"dataType":"enum","enums":["Sad"]}]},"phoneNumbers": {"dataType":"array","array":{"dataType":"string"},"required":true},},"additionalProperties": false,},// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa"Pick_User.email-or-name-or-phoneNumbers_": {"dataType": "refAlias","type": {"dataType":"nestedObjectLiteral","nestedProperties":{"email":{"dataType":"string","required":true},"name":{"dataType":"string","required":true},"phoneNumbers":{"dataType":"array","array":{"dataType":"string"},"required":true}},"validators":{}},},// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa"UserCreationParams": {"dataType": "refAlias","type": {"ref":"Pick_User.email-or-name-or-phoneNumbers_","validators":{}},},// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa};consttemplateService=newExpressTemplateService(models,{"noImplicitAdditionalProperties":"throw-on-extras","bodyCoercion":true});// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoaexportfunctionRegisterRoutes(app: Router){// ###########################################################################################################// NOTE: If you do not see routes for all of your controllers in this file, then you might not have informed tsoa of where to look// Please look into the "controllerPathGlobs" config option described in the readme: https://github.com/lukeautry/tsoa// ###########################################################################################################app.get('/users/:userId',
...(fetchMiddlewares<RequestHandler>(UsersController)),
...(fetchMiddlewares<RequestHandler>(UsersController.prototype.getUser)),asyncfunctionUsersController_getUser(request: ExRequest,response: ExResponse,next: any){constargs: Record<string,TsoaRoute.ParameterSchema>={userId: {"in":"path","name":"userId","required":true,"dataType":"double"},name: {"in":"query","name":"name","dataType":"string"},};// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoaletvalidatedArgs: any[]=[];try{validatedArgs=templateService.getValidatedArgs({ args, request, response });constcontroller=newUsersController();awaittemplateService.apiHandler({methodName: 'getUser',
controller,
response,
next,
validatedArgs,successStatus: undefined,});}catch(err){returnnext(err);}});// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoaapp.post('/users',
...(fetchMiddlewares<RequestHandler>(UsersController)),
...(fetchMiddlewares<RequestHandler>(UsersController.prototype.createUser)),asyncfunctionUsersController_createUser(request: ExRequest,response: ExResponse,next: any){constargs: Record<string,TsoaRoute.ParameterSchema>={requestBody: {"in":"body","name":"requestBody","required":true,"ref":"UserCreationParams"},};// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoaletvalidatedArgs: any[]=[];try{validatedArgs=templateService.getValidatedArgs({ args, request, response });constcontroller=newUsersController();awaittemplateService.apiHandler({methodName: 'createUser',
controller,
response,
next,
validatedArgs,successStatus: 201,});}catch(err){returnnext(err);}});// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa}// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
Possible Solution
Downgrade to @types/express version 4.0.35
Steps to Reproduce
Create a new project following the quickstart guide, using pnpm
Context (Environment)
Version of the library: 6.2.1
Version of NodeJS: 21.7.3
Confirm you were using yarn not npm: [ ] I am using pnpm :(
Detailed Description
None
Breaking change?
None
The text was updated successfully, but these errors were encountered:
I have a typescript error in my generated routes code.
Version: 4.0.35 works
Version: 4.17.21 has errors
Sorting
I'm submitting a ...
I confirm that I
Expected Behavior
Generated code should be error free.
Current Behavior
on line 47, of the following generated code:
Possible Solution
Downgrade to @types/express version 4.0.35
Steps to Reproduce
Context (Environment)
Version of the library: 6.2.1
Version of NodeJS: 21.7.3
Detailed Description
None
Breaking change?
None
The text was updated successfully, but these errors were encountered: