pino-http
pino-http copied to clipboard
Incorrect types for exported `stdSerializers`
Hi! 👋
Firstly, thanks for your work on this project! 🙂
Today I used patch-package to patch [email protected]
for the project I'm working on.
I noticed that the serialiser types are not correct, the types refer to the serialised data structures the serialisers should produce, not to the functions themselves. The actual code values exported in the plain JS files are indeed correct so it looks like it's just the types that are mismatched.
Here is the diff that solved my problem:
diff --git a/node_modules/pino-http/index.d.ts b/node_modules/pino-http/index.d.ts
index f8355c0..60b3e28 100644
--- a/node_modules/pino-http/index.d.ts
+++ b/node_modules/pino-http/index.d.ts
@@ -10,7 +10,7 @@
import { IncomingMessage, ServerResponse } from 'http';
import pino from 'pino';
-import { SerializedError, SerializedRequest, SerializedResponse } from 'pino-std-serializers';
+import { err, req, res } from 'pino-std-serializers';
declare function PinoHttp(opts?: Options, stream?: pino.DestinationStream): HttpLogger;
@@ -58,9 +58,9 @@ export interface CustomAttributeKeys {
}
export interface StdSerializers {
- err: SerializedError;
- req: SerializedRequest;
- res: SerializedResponse;
+ err: typeof err;
+ req: typeof req;
+ res: typeof res;
}
export default PinoHttp;
This issue body was partially generated by patch-package.
Thanks for reporting! Would you like to send a Pull Request to address this issue?
Hi @mcollina ! Unfortunately I am currently super busy on a customer project, that's why I decided to at least submit an issue with the patch. 😢 🤷♂️
Looks fixed by #252. 🎉