Skip to content

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

@PaulieScanlon

Description

@PaulieScanlon

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?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions