-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Labels
Description
Background: I'm converting a smallish package to Flow, in order to sell it to the team as a general part of our codebase.
Running 0.24.2, using the following example:
// @flow
import React, {Component, PropTypes} from 'react';
export class TestComponent extends Component {
// props: {
// message: string
// };
someMethod() {
console.log(this.props.badField);
}
render() {
return <div>{this.props.message}</div>;
}
}
TestComponent.propTypes = {
message: PropTypes.string
};
Flow tells me this code has no problems. If I uncomment the duplicate props type definition, it correctly flags badField as non-existent. Using a static propTypes = {...} does not solve the problem.
I understand that duplicating the propTypes as a Flow type will fix the problem in this limited example, but I'll never get the rest of my team on-board with Flow if they have to write out all their propTypes twice. We would also not get any error messages as the duplicate definitions diverged over time, which kind of defeats the purpose of the exercise.
benvium, theblang and nem035