react-docgen-typescript-loader icon indicating copy to clipboard operation
react-docgen-typescript-loader copied to clipboard

Importing component defined in index breaks the docgen

Open NathanDeveloping opened this issue 5 years ago • 1 comments
trafficstars

doesn't work :

index.tsx

import * as React from 'react';

export interface AProps {
  name?: string;
}

const A: React.FunctionComponent<AProps> = ({name}) => {
  return <p>{name}</p>;
};

A.displayName = 'A';

export {A};

a.story.mdx

import {Meta, Story, Preview, Props} from '@storybook/addon-docs/blocks';
import {A} from '.';  // <------------------

<Meta title="A" component={A} />

<Story name="Default">
  <A name="pelo" />
</Story>

<Props of={A} />

works:

A.tsx

same as index.tsx above

a.story.tsx

import {A} from './A'; // <------------------

<Meta title="A" component={A} />

<Story name="Default">
  <A name="pelo" />
</Story>

<Props of={A} />

NathanDeveloping avatar Jan 23 '20 14:01 NathanDeveloping

It seems that component files named with hypen cannot be parsed too

NathanDeveloping avatar Jan 30 '20 13:01 NathanDeveloping