Files
test-repo/tests/flow/new_react/props.js
T
Christopher Chedeau 3375cfe605 Move tests around (#454)
* new_tests

* move_all_clobbered_tests

* remove all the tests that no longer exist

* re-run flow tests

* Move all the flow tests to tests/flow and prettier to tests/

* Move prettier tests to their own folders

* Add jsfmt files

* run prettier snapshot tests
2017-01-24 14:35:37 -08:00

28 lines
649 B
JavaScript

var React = require('react');
var TestProps = React.createClass({
propTypes: {
x: React.PropTypes.string,
z: React.PropTypes.number
},
getDefaultProps: function() {
return {x: '', y: 0}
},
test: function() {
var a: number = this.props.x; // error
var b: string = this.props.y; // error
var c: string = this.props.z; // error
}
});
var element = <TestProps x={false} y={false} z={false} />; // 3 errors
(element: $jsx<*>);
(element: $jsx<TestProps>);
var FooProps = React.createClass({
propTypes: { w: React.PropTypes.string.isRequired }
});
(element: $jsx<FooProps>);