From 0015d59d71c2f32e4e7ee2b887bd2acc06ab502f Mon Sep 17 00:00:00 2001 From: luna Date: Mon, 1 Jan 2024 20:00:59 +1030 Subject: [PATCH] fix: error method not accepting error field --- src/logger.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/logger.ts b/src/logger.ts index a66b2d4..6322126 100644 --- a/src/logger.ts +++ b/src/logger.ts @@ -74,19 +74,23 @@ type Literal = z.infer; type Json = Literal | { [key: string]: Json } | Json[]; type MetaForSchema = [Message] extends [never] - ? z.input> + ? Level extends 'error' + ? z.input< + z.ZodType<{ + error: Error; + }> + > + : z.input> : Message extends keyof Schema[Level] ? Schema[Level][Message] extends z.ZodType - ? z.input + ? z.input : Schema[Level][Message]> : undefined : never; type DebugMeta = MetaForSchema; type InfoMeta = MetaForSchema; type WarnMeta = MetaForSchema; -type ErrorMeta = { - error: Error; -} & MetaForSchema; +type ErrorMeta = MetaForSchema; export class Logger { private logger: WinstonLogger;