From 4f9e5a6ca6b24947534b180234f90c3630a6a960 Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Sat, 17 Sep 2022 16:59:51 +0200 Subject: [PATCH] fix: correct type of `args` passed to `hooks.logMethod` (#1558) --- pino.d.ts | 2 +- test/types/pino.test-d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pino.d.ts b/pino.d.ts index bbaac6ee8..5442034e1 100644 --- a/pino.d.ts +++ b/pino.d.ts @@ -600,7 +600,7 @@ declare namespace pino { * log method and method is the log method itself, and level is the log level. This hook must invoke the method function by * using apply, like so: method.apply(this, newArgumentsArray). */ - logMethod?: (this: Logger, args: any[], method: LogFn, level: number) => void; + logMethod?: (this: Logger, args: Parameters, method: LogFn, level: number) => void; }; /** diff --git a/test/types/pino.test-d.ts b/test/types/pino.test-d.ts index e4ef8c885..f103d6587 100644 --- a/test/types/pino.test-d.ts +++ b/test/types/pino.test-d.ts @@ -230,7 +230,7 @@ const withHooks = pino({ hooks: { logMethod(args, method, level) { expectType(this); - return method.apply(this, ['msg', ...args]); + return method.apply(this, args); }, }, });