Files
test-repo/tests/flow/new_react/bad_default_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

31 lines
640 B
JavaScript

var React = require('React');
type T1 = { }
type T2 = { x: number }
type T3 = { x: number, y: number }
class C1 extends React.Component<T1, T2, any> { // error
}
class C2 extends React.Component<void, T2, any> { // OK
}
// no need to add type arguments to React.Component
class C3 extends React.Component { // OK
static defaultProps: T1;
props: T2;
}
class C4 extends React.Component { // OK, recommended
// no need to declare defaultProps unless necessary
props: T2;
}
class C5 extends React.Component<T2, T3, any> { // error
}
class C6 extends React.Component { // OK, recommended
static defaultProps: T2;
props: T3;
}