react-docgen-typescript icon indicating copy to clipboard operation
react-docgen-typescript copied to clipboard

Add support for @defaultValue TSDoc tag

Open jrolfs opened this issue 1 year ago • 5 comments

This adds support for the @defaultValue tag from the TSDoc specification. The existence of both specs can be pretty confusing because there's quite a bit of overlap, but I think ultimately what we're writing in .ts files is TSDoc as it doesn't include the type information like JSDoc does. I kept support for the @default tag both for backward compatibility and because TypeScript does support actual JSDoc in .js files, though I'm not sure whether this tool actually does support that case.

For reference:

  • https://tsdoc.org/pages/tags/defaultvalue/
  • https://github.com/microsoft/tsdoc/issues/27
  • https://jsdoc.app/tags-default.html

I'm happy to address any feedback and thanks for this wonderful tool!

jrolfs avatar Mar 06 '23 20:03 jrolfs

It may also be worth considering the use case identified in https://github.com/styleguidist/react-docgen-typescript/issues/457, though I think we'd probably want to add an option like preferDefaultTag to optionally force @default and @defaultValue to take precedence over the default assignment in a component.

jrolfs avatar Mar 06 '23 20:03 jrolfs

What's the status of this PR?

Thank you for your response :)

BAISTM avatar Sep 08 '23 13:09 BAISTM

Hey @BAISTM, I think this project may be a little stalled out. At this point, a fork may be our best option. I don't have an acute need for this at the moment, but if I return to the work that prompted this PR, I may get a fork going and release something from there. In which case, I'll let you know here.

jrolfs avatar Sep 15 '23 21:09 jrolfs

Hi guys, @jrolfs you are right. I tried to open a discussion about it here #494.

pvasek avatar Sep 16 '23 08:09 pvasek

@jrolfs Thank you for your response, I already did a work-around in my project. The fork can be a good solution if someone can ensure it's maintainability.

BAISTM avatar Sep 19 '23 11:09 BAISTM