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

20 lines
664 B
JavaScript

var o1 = { x: 0 };
var s1: string = o1.y; // error
var o2: { x: number; y?: string; } = { x: 0 };
var s2: string = o2.y || ""; // ok
var o3: { x: number; y?: string; } = ({ x: 0, y: 0 }: { x: number; });
var s3: string = o3.y || ""; // error
var o4: { x: number; y?: string; } = ({ x: 0 }: { x: number; [_:any]:any});
var s4: string = o4.y || ""; // ok
var o5 = { x: 0, ...{} };
var s5: string = o5.y; // ok (spreads make object types extensible)
var o6: { x: number; [_:any]:any } = { x: 0 };
var s6: string = o6.y; // ok (indexers make object types extensible)
var o7: { x: number; y?: string; } = ({ x: 0, y: 0 }: { x: number; [_:any]:number}); // error