Skip to content

Commit

Permalink
chore: export RouteGenericInterface (#4234)
Browse files Browse the repository at this point in the history
* chore: export RouteGenericInterface

* add test for re-exported type

* Update test/types/fastify.test-d.ts

Co-authored-by: Uzlopak <aras.abbasi@googlemail.com>

Co-authored-by: Chris Crewdson <christopher.crewdson@walmart.com>
Co-authored-by: Uzlopak <aras.abbasi@googlemail.com>
  • Loading branch information
3 people committed Sep 7, 2022
1 parent 8073957 commit 16b25c8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion fastify.d.ts
Expand Up @@ -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'
Expand Down
8 changes: 8 additions & 0 deletions test/types/fastify.test-d.ts
Expand Up @@ -8,6 +8,7 @@ import fastify, {
LightMyRequestResponse,
LightMyRequestCallback,
InjectOptions, FastifyBaseLogger,
RouteGenericInterface,
ValidationResult
} from '../../fastify'
import { ErrorObject as AjvErrorObject } from 'ajv'
Expand Down Expand Up @@ -232,3 +233,10 @@ const ajvErrorObject: AjvErrorObject = {
message: ''
}
expectAssignable<ValidationResult>(ajvErrorObject)

const routeGeneric: RouteGenericInterface = {}
expectType<unknown>(routeGeneric.Body)
expectType<unknown>(routeGeneric.Headers)
expectType<unknown>(routeGeneric.Params)
expectType<unknown>(routeGeneric.Querystring)
expectType<unknown>(routeGeneric.Reply)

0 comments on commit 16b25c8

Please sign in to comment.