From d8fe873ac0fc2187aa87768d5725ae277e8d3d00 Mon Sep 17 00:00:00 2001 From: Oliver Eyton-Williams Date: Thu, 11 Jul 2024 16:27:28 +0200 Subject: [PATCH] fix(types): use void as csrfProtection's return type (#159) --- 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) }