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;