Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"the types mismatch" warning when using same prop name with different types #11229

Closed
csardinha opened this issue Jun 18, 2020 · 2 comments
Closed

Comments

@csardinha
Copy link

csardinha commented Jun 18, 2020

Describe the bug

Storybook (addon-docs) shows a warning in console when defining a prop and defaultProp with the same name but different types in two different components.

To Reproduce
Steps to reproduce the behavior:

  1. Create a React Storybook with the addon-docs
  2. Create two React components with a prop that has the same name but different types:
MyFirstComponent.propTypes = {
      myProp: PropTypes.number
}

MyFirstComponent.defaultProps = {
      myProp: 0
}
MySecondComponent.propTypes = {
      myProp: PropTypes.array
}

MySecondComponent.defaultProps = {
      myProp: []
}
  1. Check the console

image

Expected behavior
No error should appear in the console

System:

Environment Info:

System:
OS: macOS 10.15.5
CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Binaries:
Node: 12.16.1 - ~/.nvm/versions/node/v12.16.1/bin/node
Yarn: 1.22.4 - ~/.nvm/versions/node/v12.16.1/bin/yarn
npm: 6.13.4 - ~/.nvm/versions/node/v12.16.1/bin/npm
Browsers:
Chrome: 83.0.4103.106
Safari: 13.1.1
npmPackages:
@storybook/addon-a11y: 6.0.0-beta.23 => 6.0.0-beta.23
@storybook/addon-actions: 6.0.0-beta.23 => 6.0.0-beta.23
@storybook/addon-docs: 6.0.0-beta.23 => 6.0.0-beta.23
@storybook/addon-storyshots: 6.0.0-beta.23 => 6.0.0-beta.23
@storybook/addon-storyshots-puppeteer: 6.0.0-beta.23 => 6.0.0-beta.23
@storybook/addons: 6.0.0-beta.23 => 6.0.0-beta.23
@storybook/react: 6.0.0-beta.23 => 6.0.0-beta.23
@storybook/theming: 6.0.0-beta.23 => 6.0.0-beta.23
@storybook/vue: 6.0.0-beta.23 => 6.0.0-beta.23

@csardinha csardinha changed the title "the types mismatch" warning when using defaultProp [] to prop "the types mismatch" warning when using same prop name with different types Jun 18, 2020
@shilman shilman added this to the 6.0 docs milestone Jun 19, 2020
@stale
Copy link

stale bot commented Jul 11, 2020

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

@shilman
Copy link
Member

shilman commented Jul 21, 2020

Son of a gun!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.0.0-rc.13 containing PR #11624 that references this issue. Upgrade today to try it out!

You can find this prerelease on the @next NPM tag.

Closing this issue. Please re-open if you think there's still more to do.

@shilman shilman closed this as completed Jul 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants