Repository navigation
Conversation
Logger#configure never reads either option off the options object, so
createLogger({handleExceptions: true}) type-checked and then did nothing.
They are transport options, and winston-transport's TransportStreamOptions
already declares them.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017D7mLNAWavucy6fFFPZise
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
index.d.tsdeclareshandleExceptionsandhandleRejectionsonLoggerOptions:Logger#configurenever reads either one. Its destructuring list issilent, format, defaultMeta, levels, level, exitOnError, transports, colors, emitErrs, formatters, padLevels, rewriters, stripColors, exceptionHandlers, rejectionHandlers— neither name appears, andnothing else on the logger path looks at them. The only place the implementation reads them is
logger.js:387, off a transport:So TypeScript accepts
createLogger({handleExceptions: true})and it silently does nothing.Reproduction
Against
master(ff0b79d), before any change.Compile side —
tscaccepts it:Runtime side — nothing is registered:
The README is already correct on this — it documents the flag as a transport option ("you can
set
handleExceptionsto true when adding transports", and "pass in separate transports to theexceptionHandlersproperty or sethandleExceptionson any transport"). Only the typedeclaration disagrees.
The change
Drops the two properties from
LoggerOptions, and adds@ts-expect-errorcases totest/typescript-definitions.tsso they cannot come back unnoticed.Removing them does not affect the supported usage:
winston-transport'sTransportStreamOptionsalready declares both, sonew transports.Console({handleExceptions: true})still type-checks. The test I added assertsexactly that, alongside the two negative cases.
Judgement call
I removed the properties rather than marking them
@deprecated.@deprecatedwould imply theyused to work at this level and are being phased out; as far as I can tell they never did
anything here, so a deprecation notice would be misleading. The cost of removing is that anyone
passing them today gets a new compile error — but their code is already not doing what they
think it is, so surfacing that seems like the point. If you would rather keep them as
@deprecatedno-ops for a release to soften the break, say so and I will switch it.Verification
I checked that the new test actually catches the regression rather than passing vacuously — with
index.d.tsreverted to master and the test file kept,tsc --project testfails:Limits: macOS arm64, Node 22.18, TypeScript from
npx --package typescriptastest:typescriptinvokes it. I did not run the integration suite. CI will need to confirm Linux and the
TypeScript versions in the matrix.
No linked issue — I found this by diffing
index.d.tsagainst the implementation. I searchedopen and closed issues and PRs first; nothing covers it, and none of the eight open PRs touching
index.d.ts(#2636, #2601, #2541, #2349, #2323, #2038, #1901, #1766) modifies these lines.