strothj / react-docgen-typescript-loader

Webpack loader to generate docgen information from Typescript React components.
Other
360 stars 47 forks source link

TypeError: type.symbol.getEscapedName is not a function #58

Open qingjinlyc opened 4 years ago

qingjinlyc commented 4 years ago

My webpack.config.json:

const path = require('path');
module.exports = ({ config }) => {
    config.module.rules.push({
      test: /\.(ts|tsx)$/,
      use: [
        {
          loader: require.resolve('awesome-typescript-loader'),
          options: {
            configFileName: path.resolve(__dirname, './tsconfig.json'),
            transpileOnly: true,
            errorsAsWarnings: true  
          }
        },
        {
          loader: require.resolve('react-docgen-typescript-loader'),
        },
      ],
    });
    config.resolve.extensions.push('.ts', '.tsx');
    return config;
};

I am using it with storybook. When I run yarn storybook, error occurs:

ERROR in ./src/components/ui/commons/TitleTwo.tsx
Module build failed (from ./node_modules/react-docgen-typescript-loader/dist/index.js):
TypeError: type.symbol.getEscapedName is not a function
    at Parser.getComponentInfo (E:\node_modules\react-docgen-typescript\src\parser.ts:238:20)
    at E:\node_modules\react-docgen-typescript\src\parser.ts:959:20
    at Array.map (<anonymous>)
    at E:\node_modules\react-docgen-typescript\src\parser.ts:958:12
    at Array.reduce (<anonymous>)
    at parseWithProgramProvider (E:\node_modules\react-docgen-typescript\src\parser.ts:947:6)
    at Object.parseWithProgramProvider (E:\node_modules\react-docgen-typescript\src\parser.ts:171:14)
    at processResource (E:\node_modules\react-docgen-typescript-loader\src\loader.ts:113:32)
    at Object.loader (E:\node_modules\react-docgen-typescript-loader\src\loader.ts:39:23)
 @ ./stories/Titles-Stories.tsx 4:0-61 9:45-53
 @ ./stories sync \.tsx$
 @ ./.storybook/config.ts
 @ multi ./node_modules/@storybook/core/dist/server/common/polyfills.js ./node_modules/@storybook/core/dist/server/preview/globals.js ./.storybook/config.ts (webpack)-hot-middleware/client.js?reload=true

Any idea of this? Thanks.