Skip to content
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

“declare class” vs “export class” #90

Open
SmartFoxServer opened this issue Aug 8, 2019 · 3 comments
Open

“declare class” vs “export class” #90

SmartFoxServer opened this issue Aug 8, 2019 · 3 comments

Comments

@SmartFoxServer
Copy link

First of all let me state that I'm new to .d.ts generation, so I could be making wrong assumptions. In such case, please help me better understand the topic.

I need to generate the d.ts file for a UMD library I developed and bundled with Webpack.
JSDoc + tsd-jsdoc does the job, but when I test the output file in Visual Studio Code, IntelliSense is not working at all.

I compared the output file with a d.ts file generated by the tool dts-gen, which works fine in VSC (but it is not useful for my needs because it doesn't recognize the types and doesn't include the JSDoc documentation).

dts-gen declares the classes contained in my library like this: export class SmartFox
Instead tsd-jsdoc output contains the following: declare class SmartFox

If I search-and-replace all "declare class" with "export class" and re-test in VSC, everything works as expected, as you can see in the attached pictures:

Schermata 2019-08-07 alle 11 07 32
Schermata 2019-08-07 alle 11 07 45
Schermata 2019-08-07 alle 11 08 23

Can you help understand what am I doing wrong?

Additionally, as you can see in the pictures, the html tags contained in my jsdoc (i.e. <p> or <caption>) are not stripped. Does that depends on tsd-jsdoc or Visual Studio Code itself?

Thank you for your help.

@englercj
Copy link
Owner

You're not doing anything wrong, we just always use declare currently for top-level declarations. You can see more details in #64. I'm open to PRs.

@SmartFoxServer
Copy link
Author

Thanks.
Any ideas about the html tags issue?

@englercj
Copy link
Owner

We output the jsdoc comment exactly as it is given to us from jsdoc. If you have html tags in there, they will exist in the output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants