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

22 lines
530 B
JavaScript

// passing a union-like thing into an overload is ok
// if overload handles each branch of union-like thing
// unions
declare function f(x: string): void;
declare function f(x: number): void;
declare var x_f: string | number;
f(x_f); // ok
// maybe
declare function g(x: null): void;
declare function g(x: void): void;
declare function g(x: string): void;
declare var x_g: ?string;
g(x_g); // ok
// optional
declare function h(x: void): void;
declare function h(x: string): void;
declare var x_h: {p?: string};
h(x_h.p); // ok