Pavel
Pavel

Reputation: 2193

Storybook: auto generate docs from typescript

At the moment I'm using react-docgen-typescript-loader to automatically generate docs

Downloads last 30 days: 1.2m

But this plugin is no longer supported and archived: https://github.com/strothj/react-docgen-typescript-loader

Also doesn't work with typescript ^4.3 (https://github.com/styleguidist/react-docgen-typescript/issues/356), because the loader uses the old version of the react-docgen-typescript

Is there any other way to automatically generate docs from TS?

Upvotes: 3

Views: 5104

Answers (1)

Pavel
Pavel

Reputation: 2193

Actually, I didn't notice any difference after deleting react-docgen-typescript-loader and using react-docgen-typescript

https://storybook.js.org/docs/ember/configure/typescript#mainjs-configuration

// .storybook/main.js

module.exports = {
  typescript: {
    check: false,
    checkOptions: {},
    reactDocgen: 'react-docgen-typescript',
    reactDocgenTypescriptOptions: {
      shouldExtractLiteralValuesFromEnum: true,
      propFilter: (prop) => (prop.parent ? !/node_modules/.test(prop.parent.fileName) : true),
    },
  },
};

Upvotes: 5

Related Questions