Files
test-repo/tests/flow/structural_subtyping/obj.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

21 lines
445 B
JavaScript

/**
* @flow
*/
interface IHasXString {
x: string;
}
var propTest1: IHasXString = { x: 'hello' };
var propTest2: IHasXString = { x: 123 }; // Error string != number
var propTest3: IHasXString = {}; // Property not found
var propTest4: IHasXString = ({}: Object);
function propTest5(y: {[key: string]: string}) {
(y: IHasXString); // OK
}
function propTest6(y: {[key: string]: number}) {
(y: IHasXString); // error: string != number
}