diff --git a/fastify.d.ts b/fastify.d.ts index 76a3895e04..41afbb8f9e 100644 --- a/fastify.d.ts +++ b/fastify.d.ts @@ -197,7 +197,7 @@ export { FastifyPluginCallback, FastifyPluginAsync, FastifyPluginOptions, Fastif export { FastifyListenOptions, FastifyInstance, PrintRoutesOptions } from './types/instance' export { FastifyLoggerOptions, FastifyBaseLogger, FastifyLoggerInstance, FastifyLogFn, LogLevel } from './types/logger' export { FastifyContext, FastifyContextConfig } from './types/context' -export { RouteHandler, RouteHandlerMethod, RouteOptions, RouteShorthandMethod, RouteShorthandOptions, RouteShorthandOptionsWithHandler } from './types/route' +export { RouteHandler, RouteHandlerMethod, RouteOptions, RouteShorthandMethod, RouteShorthandOptions, RouteShorthandOptionsWithHandler, RouteGenericInterface } from './types/route' export * from './types/register' export { FastifyBodyParser, FastifyContentTypeParser, AddContentTypeParser, hasContentTypeParser, getDefaultJsonParser, ProtoAction, ConstructorAction } from './types/content-type-parser' export { FastifyError } from '@fastify/error' diff --git a/test/types/fastify.test-d.ts b/test/types/fastify.test-d.ts index 750e4d2547..d30146d399 100644 --- a/test/types/fastify.test-d.ts +++ b/test/types/fastify.test-d.ts @@ -8,6 +8,7 @@ import fastify, { LightMyRequestResponse, LightMyRequestCallback, InjectOptions, FastifyBaseLogger, + RouteGenericInterface, ValidationResult } from '../../fastify' import { ErrorObject as AjvErrorObject } from 'ajv' @@ -232,3 +233,10 @@ const ajvErrorObject: AjvErrorObject = { message: '' } expectAssignable(ajvErrorObject) + +const routeGeneric: RouteGenericInterface = {} +expectType(routeGeneric.Body) +expectType(routeGeneric.Headers) +expectType(routeGeneric.Params) +expectType(routeGeneric.Querystring) +expectType(routeGeneric.Reply)