fastify/help

How to type Fastify Prehandlers that have been extracted outside of the route?

Closed this issue · 1 comments

💬 I'm wondering how I should type my application code to use a Fastify preHandler outside of the route (extracted to a constant)

I've got this code here: https://github.com/lifeiscontent/fastify-example/pull/1/files
and I have created Application Types for the PreHandlers, but I'm wondering if there's a preferred way to do this.

Right now I have to manually specify if its Async or not, but it would be nice to just have the type system infer this for me rather than having to explicitly mark it, is there a preferred way of typing preHandlers that are passed into routes?

Your Environment

  • defined in project source

Code is not available anymore. Sorry for the long delay.