Closed
Description
openedon Jul 8, 2020
Since it is mentioned in the README of the rule I expected this to work with TypeScript.
However it seems like it doesn't:
import PropTypes from 'prop-types';
import {Component} from 'react';
const propTypes = {
b: PropTypes.number,
a: PropTypes.number // An error is shown here
};
type Props = {
b?: number;
a?: number; // No error shown here
};
export class A extends Component<Props> {
public static propTypes = propTypes;
public render() {
const {a, b} = this.props;
return (
<p>
{a} {b}
</p>
);
}
}
export function B({a, b}: Props) {
return (
<p>
{a} {b}
</p>
);
}
B.propTypes = propTypes;
Here's a reproduction repository: https://github.com/amannn/eslint-plugin-react-test
Thanks!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment