-
-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't error on missing re-exported declarations #332
base: master
Are you sure you want to change the base?
Conversation
Warn if exports don't have declarations
I'm not sure I agree with this.
This feels like the only correct solution in a given situation, and the reason for this is because if a package is marked as "dev dependency" how come you're able to import it (even via transitive files)? It feels like some sort of misconfiguration. Can you share an example what packages generate such situation?
Do you have
Never thought about it tbh, I'm open for suggestions tho. |
Hey @timocov, thanks so much for getting back to me on this and for giving me some valuable insights into what's going on.
That's fair enough and I completely understand why you'd want to fail if declarations are missing.
Looking at our shared tsconfig package, yes we do have it enabled across our org. 😞 Based on your questions and a little digging this is what I've understood now...
Disabling This is clearly a misconfiguration on our part and we need to figure out how to solve that at our end properly. For now it's been fixes in the 11.2.0 release of Even so, would you be willing to accept a PR that would catch the error and re-throw it along with a helpful message in this scenario that a declaration for "package x" cannot be found?
I'm using the package programatically along with another TS related package of ours to inline all imported packages when generating a types file. Being able to set the log level at the API to surface issues/errors would be quite helpful. |
Hey 👋
Many thanks for creating this package. It's really useful! 👏👏👏
I've come across a situation where some packages re-export types but due to having the re-exported types dependency set as a dev dependency it isn't installed via npm and
dts-bundle-generator
errors out.This error was quite confusing for me and solving it consisted of installing the missing package in my project. However I think it might make sense to offer the option to warn users that it's missing and allow execution to continue. Alternatively maybe it's enough to throw a more helpful error msg and force the user to install the missing package to make sure types are correctly bundled. I'm opening this PR as a starting point to discuss this further.
From my investigations without the re-exported package installed it seems typescript treats the missing re-exported packages as
any
and doesn't seem to surface any errors (at least none that I could find).Additionally whilst doing this I noticed there is no way to change the log level when using this packages API. Is that something you'd consider adding as an option?