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

Storybook addon-docs - imported flow types - flow intersection #11289

Closed
PaulieScanlon opened this issue Jun 24, 2020 · 3 comments
Closed

Storybook addon-docs - imported flow types - flow intersection #11289

PaulieScanlon opened this issue Jun 24, 2020 · 3 comments

Comments

@PaulieScanlon
Copy link

PaulieScanlon commented Jun 24, 2020

I'm using `

  • "@storybook/react": "^5.3.19"`
  • "@storybook/preset-create-react-app": "^3.0.1"
  • "@storybook/addon-docs": "^5.3.19"
  • "flow-bin": "^0.109.0"

The prop table is populated with my prop types / descriptions but ONLY if a type is declared in the same file as the component.

This works:

// chart.js
// @flow

type widgetPropsT = {
  /** The title of the chart */
  title: string,
  /** The subtitle of the chart */
  subtitle: string,
  /** The Description to display in the Tooltip */
  description: string,
  /** Displays the loading state */
  loading?: boolean,
  /** Displays the error state */
  errors?: boolean
};

type Props = widgetPropsT & {
  /** The data to display */
  graphData: {
    key: string,
    label: string,
    unitType: unitTypeT,
    type: displayChartTypeEnum,
    chartData: chartDataT[]
  }[]
};

cont Chart = ({
  title,
  subtitle,
  description,
  graphData,
  loading,
  errors
}: Props) => {
...
}

But because widgetPropsT is common i'd like to keep it in a common place eg:

// chart.js
// @flow

import type { widgetPropsT } from '../common/types';

type Props = widgetPropsT & {
  /** The data to display */
  graphData: {
    key: string,
    label: string,
    unitType: unitTypeT,
    type: displayChartTypeEnum,
    chartData: chartDataT[]
  }[]
};

cont Chart = ({
  title,
  subtitle,
  description,
  graphData,
  loading,
  errors
}: Props) => {
...
}

But when i do this only the graphData prop is output to the prop table...

I know Flow is hateful but i'm stuck with it, anyone else come across this problem?

@shilman
Copy link
Member

shilman commented Jun 25, 2020

@PaulieScanlon this issue corresponds to reactjs/react-docgen#352 / reactjs/react-docgen#33

@stale
Copy link

stale bot commented Jul 25, 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!

@stale stale bot added the inactive label Jul 25, 2020
@stale
Copy link

stale bot commented Aug 24, 2020

Hey there, it's me again! I am going close this issue to help our maintainers focus on the current development roadmap instead. If the issue mentioned is still a concern, please open a new ticket and mention this old one. Cheers and thanks for using Storybook!

@stale stale bot closed this as completed Aug 24, 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