react-docgen-typescript-loader
react-docgen-typescript-loader copied to clipboard
Imported `enum` types are displayed with propType "any"
If a component uses a prop of an enum
that is imported from another file, the propType
will be shown as any
.
This will correctly label the color
property as propType
Color
:
// SomeComponent.tsx
import * as React from 'react';
export enum Color {
PRIMARY = 'primary',
SECONDARY = 'secondary',
COMPLEMENTARY = 'complementary',
TERTIARY = 'tertiary',
ANCILLARY = 'ancillary',
}
interface Props {
/** The color */
color?: Color;
}
const SomeComponent: React.SFC<Props> = (props) => {
return 'test';
};
export default SomeComponent;
This will incorrectly label the color
property as propType
any
:
// Color.ts
export enum Color {
PRIMARY = 'primary',
SECONDARY = 'secondary',
COMPLEMENTARY = 'complementary',
TERTIARY = 'tertiary',
ANCILLARY = 'ancillary',
}
// SomeComponent.tsx
import * as React from 'react';
import { Color } from './Color';
interface Props {
/** The color */
color?: Color;
}
const SomeComponent: React.SFC<Props> = (props) => {
return 'test';
};
export default SomeComponent;