However, if the code for your endpoint is in a separate file, typings will not be automatically available. This is where the TypedRequest, TypedRequestBody etc. types come in: the typeof a ZodSchema can be passed into the TypedRequest, providing your function with typings. An example:
if I use something like this, do I get the types?
const {body , query , params} = validateRequest(schema , req) // directly using in the controller instead of the middleware.
I think for this there would be a need of req argument to be passed
if I use something like this, do I get the types?
const {body , query , params} = validateRequest(schema , req) // directly using in the controller instead of the middleware.
I think for this there would be a need of req argument to be passed