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
Adding the defaults to RouteOptions the error goes away. I think this is the desirable behavior.
Paste the results here:
/** * Route configuration options such as "url" and "method" */interfaceRouteOptions<HttpServer=http.Server,HttpRequest=http.IncomingMessage,HttpResponse=http.ServerResponse,Query=DefaultQuery,Params=DefaultParams,Headers=DefaultHeaders,Body=DefaultBody>extendsRouteShorthandOptions<HttpServer,HttpRequest,HttpResponse,Query,Params,Headers,Body>{method: HTTPMethod|HTTPMethod[]url: stringhandler: RequestHandler<HttpRequest,HttpResponse,Query,Params,Headers,Body>}
Your Environment
node version: 10
fastify version: 2.4.1
os: Mac
The text was updated successfully, but these errors were encountered:
Yes this change would be valid (in fact it is almost identical to the upcoming v3 types just using different generics). Would you like to send a pr to update this on master?
馃悰 Bug Report
Working with routes definition I found that
RouteOptions
interface hasn't default generics declared. (https://github.com/fastify/fastify/blob/master/fastify.d.ts#L266) as opposed toRouteShorthandOptions
(https://github.com/fastify/fastify/blob/master/fastify.d.ts#L230) that it extends from.Is this a wanted behavior? I think this is too verbose since it forces to pass every time a route is declared a full set of same generics:
RouteOptions<Server, IncomingMessage, ServerResponse>
.To Reproduce
Removing generics (
<Server, IncomingMessage, ServerResponse>
) TypeScript pops a compiler error:Generic type 'RouteOptions<HttpServer, HttpRequest, HttpResponse, Query, Params, Headers, Body>' requires between 3 and 7 type arguments.
Expected behavior
Adding the defaults to
RouteOptions
the error goes away. I think this is the desirable behavior.Paste the results here:
Your Environment
The text was updated successfully, but these errors were encountered: