eslint-plugin-react
eslint-plugin-react copied to clipboard
No corresponding propTypes declaration when export type with typescript.
// Will get error: defaultProp "data" has no corresponding propTypes declaration
// from react/default-props-match-prop-types
export type TableProps = {
data?: any;
};
const defaultProps = {
data: null,
};
const Table: FC<TableProps> = ({ data }) => null;
// working well
type TableProps = {
data?: any;
};
const defaultProps = {
data: null,
};
const Table: FC<TableProps> = ({ data }) => null;
I assume the second example has a type
keyword? TableProps =
just makes a global variable of a JS object.
Yes, it has a type
keyword