From eebeef42a9f2cb6e8be8b43fff3565665f116266 Mon Sep 17 00:00:00 2001 From: Oliver Eyton-Williams Date: Thu, 11 Jul 2024 12:42:11 +0200 Subject: [PATCH] fix(types): use void as csrfProtection's return type --- types/index.d.ts | 2 +- types/index.test-d.ts | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/types/index.d.ts b/types/index.d.ts index 7b0d527..abbcd01 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -6,7 +6,7 @@ import { CookieSerializeOptions as FastifyCookieSerializeOptions } from "@fastif declare module 'fastify' { interface FastifyInstance { - csrfProtection(req: FastifyRequest, reply: FastifyReply, done: () => void): any; + csrfProtection(req: FastifyRequest, reply: FastifyReply, done: () => void): void; } interface FastifyReply { diff --git a/types/index.test-d.ts b/types/index.test-d.ts index f5898d7..f10a62a 100644 --- a/types/index.test-d.ts +++ b/types/index.test-d.ts @@ -34,6 +34,8 @@ async function run() { return req.body } }) + + fastify.addHook('onRequest', fastify.csrfProtection) }