Storybook / React Docgen Typescript Plugin error: `trim is not a function`
See original GitHub issueCurrent Behavior
I have created a package using tsdx create package-name
with the storybook option. But, when I run the command yarn storybook
, I receive the following error:
70% sealing React Docgen Typescript Plugin/home/luigi/Desktop/tsdx-test/node_modules/react-docgen-typescript/lib/parser.js:475
var trimmedText = (tag.text || '').trim();
^
TypeError: (tag.text || "").trim is not a function
at /home/luigi/Desktop/tsdx-test/node_modules/react-docgen-typescript/lib/parser.js:475:48
at Array.forEach (<anonymous>)
at Parser.getFullJsDocComment (/home/luigi/Desktop/tsdx-test/node_modules/react-docgen-typescript/lib/parser.js:474:14)
at Parser.findDocComment (/home/luigi/Desktop/tsdx-test/node_modules/react-docgen-typescript/lib/parser.js:443:28)
at Parser.getComponentInfo (/home/luigi/Desktop/tsdx-test/node_modules/react-docgen-typescript/lib/parser.js:177:23)
at /home/luigi/Desktop/tsdx-test/node_modules/react-docgen-typescript/lib/parser.js:895:30
at Array.forEach (<anonymous>)
at /home/luigi/Desktop/tsdx-test/node_modules/react-docgen-typescript/lib/parser.js:894:20
at Array.reduce (<anonymous>)
at parseWithProgramProvider (/home/luigi/Desktop/tsdx-test/node_modules/react-docgen-typescript/lib/parser.js:886:10)
at Object.parseWithProgramProvider (/home/luigi/Desktop/tsdx-test/node_modules/react-docgen-typescript/lib/parser.js:75:20)
at processModule (/home/luigi/Desktop/tsdx-test/node_modules/react-docgen-typescript-plugin/dist/plugin.js:18:34)
at /home/luigi/Desktop/tsdx-test/node_modules/react-docgen-typescript-plugin/dist/plugin.js:97:49
at Array.forEach (<anonymous>)
at /home/luigi/Desktop/tsdx-test/node_modules/react-docgen-typescript-plugin/dist/plugin.js:97:34
at SyncHook.eval [as call] (eval at create (/home/luigi/Desktop/tsdx-test/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:19:1)
error Command failed with exit code 1.
Expected behavior
yarn storybook
should work in fresh projects.
Your environment
System:
OS: Linux 5.8 Ubuntu 20.04.2 LTS (Focal Fossa)
CPU: (8) x64 Intel(R) Core(TM) i5-10210U CPU @ 1.60GHz
Memory: 2.93 GB / 15.51 GB
Container: Yes
Shell: 5.0.17 - /bin/bash
Binaries:
Node: 14.16.1 - /usr/local/bin/node
Yarn: 1.22.10 - /usr/local/bin/yarn
npm: 7.12.0 - /usr/local/bin/npm
Browsers:
Chrome: 91.0.4472.77
Firefox: 89.0
npmPackages:
tsdx: ^0.14.1 => 0.14.1
typescript: ^4.3.2 => 4.3.2
npmGlobalPackages:
tsdx: 0.14.1
Issue Analytics
- State:
- Created 2 years ago
- Reactions:9
- Comments:6
Top Results From Across the Web
TypeError: (tag.text || "").trim is not a function #356 - GitHub
We're getting this on node_modules/react-docgen-typescript/src/parser.ts:750:44 When running yarn run build-storybook with the latest ...
Read more >TypeError: (tag.text || "").trim is not a function #15067 - Issuehunt
Describe the bug We cannot start storybook due to an error within react-docgen-typescript. To Reproduce unclear. We completely removed docgen (rely on ...
Read more >storybook-addon-react-docgen
A storybook addon to display react docgen info. ... To use this plugin with a typescript project you need to install react-docgen-typescript-loader and ......
Read more >Compare Versions | @storybook/react | npm
GHSA-w5p7-h5w8-2hfqRegular Expression Denial of Service in trim ... @storybook/react-docgen-typescript-plugin ... @webassemblyjs/helper-api-error 1.11.1.
Read more >storybook/react-docgen-typescript-plugin - npm package - Snyk
Specify the name of the property for docgen info prop type. type. exclude, glob[], Glob patterns to ignore and not generate docgen information...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
There’s a workaround : https://github.com/styleguidist/react-docgen-typescript/issues/356#issuecomment-850400428
Seems like they fixed it and it was merged 5 days ago. https://github.com/styleguidist/react-docgen-typescript/issues/356