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 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
Use Fastify version 4.* in a TypeScript project.
Attempt to run the server using the command: ts-node --files src/index.ts
Observe the error related to the 'register' method in the 'fastifyRoutes' function.
Expected Behavior
No response
The text was updated successfully, but these errors were encountered:
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.
After I sneak into the source code, I find out that it uses const modifier to a type parameter, this is a new feature of Typescript 5.
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: