question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Optional values get appended undefined in Addon-docs prop table when using typescript

See original GitHub issue

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

  1. Follow this guide
  2. Run yarn storybook and see the result.

image

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:closed
  • Created 4 years ago
  • Comments:17 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
MerlinMasoncommented, Dec 10, 2021

@shilman this was v6.4.8

2reactions
vimtorcommented, Jan 12, 2020

I think is both correct and redundant. Maybe more redundant than correct since when you add more props you get something like this.

image

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:

<Button color={undefined} />

That being said, a way to filter the props would be nice however, both the rows that are being displayed and the contents.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found