From 26917b615efaa8a09d5006a105290ad53e0fe25d Mon Sep 17 00:00:00 2001 From: Roberto Bianchi Date: Wed, 24 Apr 2024 12:34:39 +0200 Subject: [PATCH] chore(type): Add `enterWith` decorator (#9) * chore(type): Add enterwith decorator * Update dependency * Dev dependency --- index.d.ts | 6 ++++++ index.test-d.ts | 2 ++ package.json | 1 + 3 files changed, 9 insertions(+) diff --git a/index.d.ts b/index.d.ts index ee2169f..c425e8e 100644 --- a/index.d.ts +++ b/index.d.ts @@ -6,6 +6,12 @@ import { type FastifyPluginCallback, } from "fastify"; +declare module "fastify" { + interface FastifyInstance { + enterWith: () => void; + } +} + declare namespace fastifyasyncforge { export function app(): T; export function request(): T; diff --git a/index.test-d.ts b/index.test-d.ts index 2f930ab..0608401 100644 --- a/index.test-d.ts +++ b/index.test-d.ts @@ -13,10 +13,12 @@ import fastify, { const fastifyInstance = fastify(); expectAssignable(fastifyInstance.register(fastifyasyncforge)); expectAssignable(fastifyasyncforge); +expectType(fastifyInstance.enterWith()); // app expectAssignable(fastifyInstance); expectAssignable(app()); +expectType(app().enterWith()); expectAssignable(app>()); expectError(app()); expectError({}); diff --git a/package.json b/package.json index 712b534..ec3a0ce 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,7 @@ "homepage": "https://github.com/mcollina/fastify-asyncforge#readme", "devDependencies": { "@matteo.collina/tspl": "^0.1.1", + "@types/node": "^20.12.7", "borp": "^0.11.0", "fastify": "^4.26.2", "standard": "^17.1.0",