pino
pino copied to clipboard
Type for mixinFn doesn't match docs - mixin doesn't actually get `logger` parameter
The docs for the mixin option state that it has 3 arguments: https://getpino.io/#/docs/api?id=mixin-function
The first parameter is the value mergeObject or an empty object. The second parameter is the log level number. The third parameter is the logger or child logger itself
However, the type declaration only has two arguments: https://github.com/pinojs/pino/blob/91a3505cfaef323f565e3cfe93f5d5077320faff/pino.d.ts#L31
Which of these versions of reality is correct?
Here's a screenshot of the resultant type error in VS code:
Pino version: 8.15.0
I think the test are the best form of documentation:
https://github.com/pinojs/pino/blob/309cdfbff7ccf4d97b6969b95daec7b6ff9455cf/test/mixin.test.js#L164-L178
Could you check the behavior and make sure docs and types are correct?
Just as a heads up, my team has worked around this issue for now and I don't expect to have time to check and update the docs.
I encountered the same problem.
Type '(obj: any, num: any, logger: any) => { tags: any; }' is not assignable to type 'MixinFn'.
Target signature provides too few arguments. Expected 3 or more, but got 2.
When can we expect this fix to be released? What would be the best workaround for now?
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.