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

Retain TSDoc comments #165

Closed
TxHawks opened this issue Jul 30, 2021 · 7 comments
Closed

Retain TSDoc comments #165

TxHawks opened this issue Jul 30, 2021 · 7 comments

Comments

@TxHawks
Copy link

TxHawks commented Jul 30, 2021

The current behavior is that Top-level comments are stripped away:

// input:
/**
 * Foo type description
 * /
type Foo = {
  /**
   *  bar prop description
   * /
  bar:  string;
};

// output:
export declare type Foo = {
  /**
   *  bar prop description
   * /
  bar:  string;
};

Which is a problem when wanting to use the top level comment blocks as code hints or to feed into a documentation generator.

It would be great if docblock comments could be retained.

@timocov
Copy link
Owner

timocov commented Aug 12, 2021

@TxHawks we have tests for that and it seems that they are all passed

/**
* ExportedType JSDoc
*/
export declare type ExportedType = string | number;
. Can you check the correctness of jsdoc and if they are correct then create a repro for that please?

@timocov
Copy link
Owner

timocov commented Nov 12, 2021

I'm going to close the issue. If you'll have any question or updates - feel free to ping me.

@timocov timocov closed this as completed Nov 12, 2021
@nartallax
Copy link

@timocov as I discovered, this behavior can be observed if "removeComments": true is present in tsconfig.json.
I have this option turned on because I don't want comments in my generated JS code (most of the comments are for library developer and not for library user anyway), but when generating .d.ts I want to have the comments because that's documentation for user.
Is it possible to add option to dts-bundle-generator that will override "removeComments": true and retain comments just for .d.ts? Or maybe you can suggest another solution?

@timocov
Copy link
Owner

timocov commented Feb 19, 2022

Well, I think the best solution here is to create another tsconfig, extend it from your one and override this setting. Did you try this?

@nartallax
Copy link

I just had a hope that dts-bundle-generator will have such useful option.

Okay, thanks, I'll do it that way.

@timocov
Copy link
Owner

timocov commented Feb 19, 2022

Also related to #137

@keyiis
Copy link

keyiis commented Mar 13, 2022

@timocov If possible, I also hope to add this function.like gulp-typescript

require("gulp-typescript").createProject("tsconfig.json",{"removeComments": false});

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

No branches or pull requests

4 participants