Star re-exports (`import * as NS` / `export * as NS`) aren't wrapped with a `NS` name
See original GitHub issueBug report
I’ve used dts-bundle-generator
to generate bundle of .d.ts
for use on Monaco Editor and some wierd Typescript compiler that runs on GraalJS that i’ve made. I have 2 globals which are actually aliases to npm modules, which are Ramda and Cheerio, they worked great on some old .d.ts
files, but when i’ve updated those libraries to its recent version, the code generation didn’t work.
Input code
import * as R from "ramda";
import * as cheerio from "cheerio";
export { R, cheerio }
Expected output
Something around this: https://gist.github.com/schleumer/3c0c7d468e050b2163760e7e4392d5cd, of course, those libs changed a lot and may be slightly different
Actual output
// Generated by dts-bundle-generator v5.4.0
export {
as R,
};
Additional context
I’ve made a custom script, something like:
const generated = generator.generateDtsBundle([
{
filePath: 'src/libs.d.ts'
}
], {
preferredConfigPath: './tsconfig.json',
followSymlinks: true,
});
Also, with internal files, dts-bundle-generator
works great, my only issue is with importing Ramda and Cheerio, don’t know if there’s something new that i’ve lost.
Thanks for the awesome library 😃
Issue Analytics
- State:
- Created 3 years ago
- Reactions:8
- Comments:16 (7 by maintainers)
Top GitHub Comments
If we can detect this then yes, I’d prefer to handle this and report an error for that for sure.
Can’t we fail instead of producing wrong code? People (e.g. I) rely on this being correct.
Frankly, I would love to do a deep dive into this. This seems like an interesting problem but I don’t have the time right now. If this is still a problem in a few weeks from now, I’ll do a PR.