/* @flow */
var React = require('react');
var Example = React.createClass({
propTypes: {
arr: React.PropTypes.arrayOf(React.PropTypes.number).isRequired,
},
});
var ok_empty =
var ok_numbers =
var fail_missing =
var fail_not_array =
var fail_mistyped_elems =
/* Since the `number` proptype argument is not required, React will actually
allow `null` and `undefined` elements in the `arr` prop, but Flow has
currently ignores the innter prop type's required flag. */
var todo_required =
var OptionalExample = React.createClass({
propTypes: {
arr: React.PropTypes.arrayOf(React.PropTypes.number),
}
});
(); // OK
(); // OK
(); // error: string ~> number
var AnyExample = React.createClass({
propTypes: {
arr: React.PropTypes.arrayOf((0:any)), // OK
},
});
(); // error: still needs to be an array
(); // OK
var InvalidExample = React.createClass({
propTypes: {
arr: React.PropTypes.arrayOf(0), // error: number not a prop type
},
});