String literals defined in another file don't get translated to propTypes
ericyliu opened this issue · 0 comments
ericyliu commented
if I define a string literal in a separate file from the react component, and use that string literal in the props of the react component, the resulting proptypes dont contain that key.
i.e.
heading.constants.ts
export type LEVEL = '1' | '2' | '3';
heading.ts
import { LEVEL } from './heading.constants.ts';
interface Props {
level: LEVEL,
}
export const Header = (props: Props) => {
<div>{props.level}</div>
}
dist/index.ts
...
Header.propTypes = {};