/// import type { ContextConfigDefault, FastifyPluginCallback, FastifyRequest, FastifySchema, HTTPMethods } from 'fastify'; import type { RouteGenericInterface, RouteShorthandOptions } from 'fastify/types/route'; import { NextServer } from 'next/dist/server/next'; import { FastifyUnderPressureOptions } from '@fastify/under-pressure'; declare module 'fastify' { type FastifyNextCallback = ( app: NextServer, req: FastifyRequest, reply: FastifyReply ) => Promise; interface FastifyInstance { next< RouteGeneric extends RouteGenericInterface = RouteGenericInterface, ContextConfig = ContextConfigDefault, SchemaCompiler extends FastifySchema = FastifySchema >( path: string, opts?: | (RouteShorthandOptions< RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler > & { method?: HTTPMethods; }) | FastifyNextCallback, handle?: FastifyNextCallback ): void; } interface FastifyReply { nextRender(path: string): Promise; nextRenderError(err: any): Promise; } } // Infer options type, because not exported from Next. type NextServerConstructor = ConstructorParameters[0]; declare namespace fastifyNext { interface FastifyNextOptions extends NextServerConstructor { underPressure?: boolean | FastifyUnderPressureOptions; noServeAssets?: boolean; } } declare const fastifyNext: FastifyPluginCallback; export default fastifyNext;