From d27222829926839e6a65023c8d612a7b2213c423 Mon Sep 17 00:00:00 2001 From: Naseem Ullah <24660299+naseemkullah@users.noreply.github.com> Date: Fri, 15 Dec 2023 11:48:38 -0500 Subject: [PATCH] fix: type variable for Logger the type variable of the logger should be the custom levels type since a recent change in pino types (https://github.com/pinojs/pino/pull/1858) fixes #313 --- index.d.ts | 6 +++--- index.test-d.ts | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/index.d.ts b/index.d.ts index ae7a88d..57a3383 100644 --- a/index.d.ts +++ b/index.d.ts @@ -12,13 +12,13 @@ import { IncomingMessage, ServerResponse } from 'http'; import pino from 'pino'; import { err, req, res, SerializedError, SerializedRequest, SerializedResponse } from 'pino-std-serializers'; -declare function PinoHttp>(opts?: Opts, stream?: pino.DestinationStream): HttpLogger; +declare function PinoHttp(opts?: Options, stream?: pino.DestinationStream): HttpLogger; declare function PinoHttp(stream?: pino.DestinationStream): HttpLogger; -export interface HttpLogger> { +export interface HttpLogger { (req: IM, res: SR, next?: () => void): void; - logger: pino.Logger; + logger: pino.Logger; } export type ReqId = number | string | object; diff --git a/index.test-d.ts b/index.test-d.ts index 5734aec..31b1bcd 100644 --- a/index.test-d.ts +++ b/index.test-d.ts @@ -208,7 +208,7 @@ const httpServerListener: RequestListener = (request, response) => { // custom levels added in the options should be available // on the logger returned by pino-http -pinoHttp({ +pinoHttp({ customLevels: { bark: 25, }