-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Closed
Labels
Description
Prerequisites
- I have written a descriptive issue title
- I have searched existing issues to ensure the bug has not already been reported
Fastify version
4.16.0
Plugin version
No response
Node.js version
18.x
Operating system
macOS
Operating system version (i.e. 20.04, 11.3, 10)
12.3
Description
The hooks specified in the options of a route no longer have the correct typings applied/resolved. They come back as any. The following code snippet works in 4.15.0, but breaks in 4.16.0
Steps to Reproduce
import Fastify from "fastify";
const fastify = Fastify();
fastify.get(
"/route",
{
onError: (request, reply, error) => {
request // is any
reply // is any
error // is any
},
},
async () => ({ success: "yes" })
);The same appears to be true for all the other hooks specified in this manner as well.
Interestingly, hooks added with addHook appear to have the correct typings resolved
Expected Behavior
No response
Reactions are currently unavailable