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

@version tag does not return the version string in the generated description.

Open massproduction opened this issue 3 years ago • 2 comments

I have these two different components. A TypeScript Button.tsx with a JsDoc with version number like here:

/**
 * _Buttons let users to perform important, clearly expressed actions._
 *
 * @version 3.0
 */

and a second JavaScript component ButtonRow.js with a JsDoc with version number like here:

/**
 * _Group of related buttons that spaces and positions them responsively in a row or a stack._
 * components.
 *
 * @version 3.0
 */

.

The problem I'm having is that when generating the components with react-docgen I get a description of the component with a version number like here: Screenshot 2021-08-20 at 11 13 25 but with react-docgen-typescript I do not get the version number: Screenshot 2021-08-20 at 11 13 54

My propsParser looks like this:

const propsParserOptions = {
  propFilter: (prop, component) => {
    if (prop.declarations !== undefined && prop.declarations.length > 0) {
      const hasPropAdditionalDescription = prop.declarations.find(
        (declaration) => {
          return !declaration.fileName.includes('node_modules');
        }
      );

      return Boolean(hasPropAdditionalDescription);
    }

    return true;
  },
  savePropValueAsString: true,
};

const jsParse = require('react-docgen');
const tsParser = require('react-docgen-typescript').withDefaultConfig(
  propsParserOptions
);

propsParser(filePath, source, resolver, handlers) {
  if (/tsx?$/.test(filePath)) return tsParser.parse(filePath);
  return jsParse.parse(source, resolver, handlers);
}

massproduction avatar Aug 20 '21 08:08 massproduction

Do you know where styleguidist expect to have this field? In other words where the parser should put it?

pvasek avatar Oct 13 '21 20:10 pvasek

There was no activity for a long time. The issue will be closed soon.

github-actions[bot] avatar Oct 14 '22 10:10 github-actions[bot]

Closing this issue as obsolete.

github-actions[bot] avatar Oct 21 '22 10:10 github-actions[bot]