-
-
Notifications
You must be signed in to change notification settings - Fork 70
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
Use-cases of incorrect result for dts-bundle-generator #5
Comments
Hi @timocov and thanks for reaching out :-) So one of the reasons is your well documented list of limitations, which are quite limiting considering how I like to usually structure my code. Most of those work just fine in But I noticed that I hit a quite hard wall when trying to re-export namespaces (https://github.com/Swatinem/rollup-plugin-dts/blob/master/src/__tests__/testcases/re-export-namespace/index.ts) I’m not sure if it is even possible to solve 😞, or if I can somehow hook more deeper into rollup to fix that case… The other thing is that I use one of my other projects intl-codegen as a guineapig here, and for some reason it does not work as well with
I have explicitly typed that external module here: https://github.com/eversport/intl-codegen/blob/master/src/intl-messageformat-parser.d.ts and it works just fine both with Also, using it on the /// <reference types="estree" />
/// <reference types="node" />
import { PluginImpl } from 'rollup';
import { CompilerOptions, ts } from 'typescript';
export declare enum CompileMode {
Types = "dts",
Js = "js"
}
export interface Options {
include?: Array<string>;
exclude?: Array<string>;
tsconfig?: string;
compilerOptions?: ts.CompilerOptions;
compileMode?: CompileMode;
}
export declare const plugin: PluginImpl<Options>;
export declare const dts: PluginImpl<Options>;
export declare const js: PluginImpl<Options>;
export default plugin; vs import { CompilerOptions } from 'typescript';
import { PluginImpl } from 'rollup';
declare enum CompileMode {
Types = "dts",
Js = "js"
}
interface Options {
include?: Array<string>;
exclude?: Array<string>;
tsconfig?: string;
compilerOptions?: CompilerOptions;
compileMode?: CompileMode;
}
declare const plugin: PluginImpl<Options>;
declare const dts: PluginImpl<Options>;
declare const js: PluginImpl<Options>;
export default plugin;
export { CompileMode, plugin, dts, js, js as ts }; There are multiple problems here:
But nevertheless, your project is still a great inspiration and influence. I have seen that you are actually (trying to) check the validity of the generated
I think you can just override that Also I have seen that you referenced me here: timocov/dts-bundle-generator#68 (comment) (will have to read that whole discussion at some point) so thanks for that :-) |
Thanks you @Swatinem for detailed answer 🙏!
😮 Whoa, it looks great! I've thought about renaming/use original imports in timocov/dts-bundle-generator#59, but didn't start work on it yet 🙁
Oh yeah, namespaces are hard to work with they 🙂
I just checked what's going on there. It seems that
I believe that the first is more correct way in this situation, because you trying to declare outside module, and it should be declared in types to treat this module "from outside". I'm not sure about that, but it looks logic/correct for me.
🤔 🙂
Maybe, I need check it - it looks strange. But namespaces are hard thing 🙁
Hm, I need to check it.
They can be removed via setting
Thank you! You've solved some hard problems in |
In this case it's |
|
So you already parse the exports? In that case it should be trivial to support renames.
I use typescript to transform |
Heads up: |
Hi @Swatinem!
I'm creator of dts-bundle-generator. Actually this isn't an issue of your tool, but just a little question - you've mentioned in the readme file that
Can you please provide some examples, where dts-bundle-generator doesn't work well for your use-cases? Your cases might be useful to improve dts-bundle-generator and I would appreciated you for providing additional interesting examples.
Thanks in advance!
The text was updated successfully, but these errors were encountered: