Update getLogger to return explicit StructuredLogger type #118
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.
Closes #115
Overview
Prior to this change, after building,
dist/src/logger.d.tsin the built package contained:After this change,
dist/src/logger.d.tsin the built package contains:Some notes:
The
import()path that is being included in the output does actually exist in a demo project I set up locally, and should properly resolve (albeitloggerwould have to resolve tologger.d.tsand notlogger.ts/logger.js). So I'm not exactly sure why the reporter is encountering this issue in the first place... maybe it's due to some angular tooling specific nuances I am unfamiliar with? Or maybe it's due to the explicitexportsentries inlivekit-client?Also, I don't really love my solution here, given that the locally defined
StructuredLoggeris set toReturnType<getLogger>, and this fix relies on that it seems like for implicit return types added in a.d.ts,importis left in while for an explicitReturnType<...>typescript seems to be smart enough to traverse through that import and get the underlying type value. Ideally, there would be some tsconfig setitng that could be included at build time or something similar that could be used to control this (I took a look and couldn't find anything though).Any ideas on how to do this in a more robust way would be appreciated!