diff --git a/index.d.ts b/index.d.ts index b710af7a4..13e43b65b 100644 --- a/index.d.ts +++ b/index.d.ts @@ -89,8 +89,6 @@ declare namespace winston { exitOnError?: Function | boolean; defaultMeta?: any; transports?: Transport[] | Transport; - handleExceptions?: boolean; - handleRejections?: boolean; exceptionHandlers?: any; rejectionHandlers?: any; } diff --git a/test/typescript-definitions.ts b/test/typescript-definitions.ts index 4fb3b6553..8df9d93f6 100644 --- a/test/typescript-definitions.ts +++ b/test/typescript-definitions.ts @@ -57,3 +57,18 @@ logger.isInfoEnabled(); logger.isVerboseEnabled(); logger.isDebugEnabled(); logger.isSillyEnabled(); + +// `handleExceptions` / `handleRejections` are transport options, not logger +// options: `Logger#configure` never reads them off the options object, so +// accepting them here silently did nothing. They belong on a transport. +winston.createLogger({ + transports: [ + new winston.transports.Console({ handleExceptions: true, handleRejections: true }), + ], +}); + +// @ts-expect-error handleExceptions is not a LoggerOptions field +winston.createLogger({ handleExceptions: true }); + +// @ts-expect-error handleRejections is not a LoggerOptions field +winston.createLogger({ handleRejections: true });