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

All props are listed as type 'unknown' #11226

Closed
redders6600 opened this issue Jun 18, 2020 · 5 comments
Closed

All props are listed as type 'unknown' #11226

redders6600 opened this issue Jun 18, 2020 · 5 comments

Comments

@redders6600
Copy link

redders6600 commented Jun 18, 2020

I'm using storybook 5.3.19 with a CRA project that I have migrated to typescript (it was previously JS and I was using PropTypes), however all of the props listed in my stories are displayed as 'other'. I am not sure where to start debugging this...

Example:

BasicSpan.tsx

type BasicSpanProps = {
  content: string;
};

export const BasicSpan: FC<BasicSpanProps> = ({ content = "test" }) => {
  return <span>{content}</span>;
};

export default WrappedDivider;

BasicSpan.stories.tsx

import { BasicSpan } from "./BasicSpan";

export const StoryOne = () => {
  return (
    <div>
      <BasicSpan content="something"></BasicSpan>
    </div>
  );
};

export default {
  title: "Basic span",
  component: BasicSpan,
};

image

This is the output of Docgen.parse:
image

@shilman
Copy link
Member

shilman commented Jun 18, 2020

Addon-info has been superceded by addon-docs, which fixes a bunch of bugs and is easier to maintain. Please give it a try! https://medium.com/storybookjs/storybook-docspage-e185bc3622bf

@redders6600
Copy link
Author

redders6600 commented Jun 18, 2020

Hi @shilman thanks for the reply - I was actually using both but I've now removed addon-info and updated the confusing screenshots. I'm still having the same problem with docs - all props are showing as unknown regardless of how I define them.

As such it is probably worth re-labelling this issue to addon: docs.

@redders6600 redders6600 changed the title All props are listed as type 'other' All props are listed as type 'unknown' Jun 18, 2020
@shilman
Copy link
Member

shilman commented Jun 18, 2020

Can you try upgrading to 6.0? We've smoothed out a lot of this there. Quick & dirty migration guide #9311

@redders6600
Copy link
Author

@shilman thanks for your suggestion - it indirectly fixed my problem. From the migration guide, npx npm-check-updates '/storybook/' -u didn't upgrade storybook or any of its plugins (probably because I'm missing a flag to include beta versions, or something), but it DID upgrade @storybook/preset-create-react-app which was on an old 2.x version - I'd totally missed it because when I upgraded storybook I wrongly assumed all of the associated addonts/presets/plugins etc were using the same version number, so I used find/replace to do the update. Obviously the preset has its own versioning, so I completely missed it... 🤦

So TL;DR: user error - outdated CRA preset.

Thanks for your help.

@shilman
Copy link
Member

shilman commented Jun 18, 2020

@redders6600 thanks for letting me know about the typo. Fixed! And glad you got it sorted!!

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