storybook: Optional values get appended undefined in Addon-docs prop table when using typescript
Describe 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 storybookand 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
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 17 (9 by maintainers)
@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
undefinedis 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.
Required props have a red star next to them. Optional props don’t. In that sense the
| undefinedis redundant. However, I’m not sure it’s a bad thing? I welcome a hard argument one way or the other 😃 cc @patricklafrance