Optional values get appended undefined in Addon-docs prop table when using typescript
See original GitHub issueDescribe the bug
When using addon:docs
prop table for React tsx components optional props marked with ?
in typescript get appended undefined
in the table.
To Reproduce
- Follow this guide
- Run
yarn storybook
and see the result.
Expected behavior
Props marked as optional don’t need the undefined
.
System: System: OS: Linux 5.0 Ubuntu 18.04.3 LTS (Bionic Beaver) CPU: (8) x64 Intel® Core™ i7-8550U CPU @ 1.80GHz Binaries: Node: 10.18.0 - /usr/bin/node Yarn: 1.21.1 - /usr/bin/yarn npm: 6.13.4 - /usr/bin/npm Browsers: Chrome: 79.0.3945.88 Firefox: 71.0 npmPackages: @storybook/cli: ^5.3.0 => 5.3.0
Issue Analytics
- State:
- Created 4 years ago
- Comments:17 (9 by maintainers)
Top Results From Across the Web
Storybook optional props force undefined - Stack Overflow
I'm building a React Storybook with Typescript. With optional props, Storybook addon add an "undefined" option. I put a defaultProps but it ...
Read more >@types/storybook__addon-knobs | Yarn - Package Manager
Angular: set the @ViewChild with a non-empty value in StorybookWrapperComponent (#14586); Addon-docs: Fix ArgsTable sorting when using of={Component} ...
Read more >storybook cannot read properties of undefined - You.com
The TypeError: Cannot read properties of undefined (reading 'type') exception occurs in storybook when one defines the argTypes in the default export object ......
Read more >https://raw.githubusercontent.com/storybooks/story...
Bug Fixes - Addon-docs/Angular: Fix inline rendering setup ... Addon-docs: Remove undefined for optional values in Typescript Props ...
Read more >Docs Addon | Storybook: Frontend workshop for UI development
Storybook Docs transforms your Storybook stories into world-class component documentation. DocsPage. Out of the box, all your stories get a DocsPage .
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
@shilman this was v6.4.8
I think is both correct and redundant. Maybe more redundant than correct since when you add more props you get something like this.
Besides looking buggy is pretty useless because you don’t need to know that
undefined
is an option since you will never pass it to a prop. I mean, you will never do something like this:That being said, a way to filter the props would be nice however, both the rows that are being displayed and the contents.