-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error with Fastify version 4.* in TypeScript: 'register' method expects 0 arguments, but got 1 in 'fastifyRoutes' #5272
Comments
There is an option object passed to your plugin as an option. |
Can you please share a code sample, that could be very helpful. like how to use |
Can you please upload all your files in a repository? Note that there is no call to |
Thanks for the response, as you can see in app.ts file I have use the register to use the routes. The issue is that when i passed the route in the app.register() and then it throws the error (a type error cause without type checking the code works fine). |
I had the same issue, upgrading to Typescript 5 should fixed this. |
Prerequisites
Fastify version
4.25.0
Plugin version
No response
Node.js version
20.8.0
Operating system
Linux
Operating system version (i.e. 20.04, 11.3, 10)
Ubuntu 22.04.3 LTS
Description
Index.ts file
app.ts
routes.ts
I am encountering an issue when using Fastify version 4.* with TypeScript. The error message suggests a problem with the 'register' method in the 'fastifyRoutes' function within my codebase. Specifically, it indicates that the 'routes'' method expects 0 arguments but receives 1. Same thing happens with other methods like GET, POST ...
i user
ts-node --files src/index.ts
to run the code.But when i try to user
Fastify version 3.*
it works perfectly no issue.Also if i try to run
ts-node **-T** --files src/index.ts
my code works but i don't want to do so.Steps to Reproduce
Expected Behavior
No response
The text was updated successfully, but these errors were encountered: