pino-http icon indicating copy to clipboard operation
pino-http copied to clipboard

Incorrect types for exported `stdSerializers`

Open robertrossmann opened this issue 2 years ago • 2 comments

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.

robertrossmann avatar Aug 28 '22 16:08 robertrossmann

Thanks for reporting! Would you like to send a Pull Request to address this issue?

mcollina avatar Aug 29 '22 07:08 mcollina

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. 😢 🤷‍♂️

robertrossmann avatar Aug 29 '22 07:08 robertrossmann

Looks fixed by #252. 🎉

robertrossmann avatar Jul 17 '23 07:07 robertrossmann