Skip to content

Commit

Permalink
fix: correct type of args passed to hooks.logMethod
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB committed Sep 16, 2022
1 parent 73678ff commit 1180761
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pino.d.ts
Expand Up @@ -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<LogFn>, method: LogFn, level: number) => void;
};

/**
Expand Down
2 changes: 1 addition & 1 deletion test/types/pino.test-d.ts
Expand Up @@ -230,7 +230,7 @@ const withHooks = pino({
hooks: {
logMethod(args, method, level) {
expectType<pino.Logger>(this);
return method.apply(this, ['msg', ...args]);
return method.apply(this, args);
},
},
});
Expand Down

0 comments on commit 1180761

Please sign in to comment.