From 4b3967b3119479055db3caadc0903cfe46d44844 Mon Sep 17 00:00:00 2001 From: Roberto Bianchi Date: Mon, 22 Apr 2024 16:12:29 +0200 Subject: [PATCH] fix(types): Add plugin function definition Signed-off-by: Roberto Bianchi --- index.d.ts | 2 ++ index.test-d.ts | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/index.d.ts b/index.d.ts index d845971..96398b6 100644 --- a/index.d.ts +++ b/index.d.ts @@ -3,6 +3,7 @@ import { type FastifyBaseLogger, type FastifyReply, type FastifyRequest, + type FastifyPluginCallback, } from "fastify"; declare namespace fastifyasyncforge { @@ -12,4 +13,5 @@ declare namespace fastifyasyncforge { export function logger(): T; } +declare function fastifyasyncforge(): FastifyPluginCallback; export = fastifyasyncforge; diff --git a/index.test-d.ts b/index.test-d.ts index 53939e6..58dfd0a 100644 --- a/index.test-d.ts +++ b/index.test-d.ts @@ -1,5 +1,5 @@ import { expectAssignable, expectError, expectType } from "tsd"; -import { app, logger, reply, request } from "."; +import fastifyasyncforge, { app, logger, reply, request } from "."; import fastify, { type FastifyInstance, type FastifyBaseLogger, @@ -7,9 +7,12 @@ import fastify, { type FastifyReply, type RawServerDefault, type RouteGenericInterface, + type FastifyPluginCallback, } from "fastify"; const fastifyInstance = fastify(); +expectAssignable(fastifyInstance.register(fastifyasyncforge)); +expectAssignable(fastifyasyncforge); // app expectAssignable(fastifyInstance);