Files
test-repo/tests/flow/call_properties/A.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
669 B
JavaScript

// You should be able to call objects with call properties
function a(f: { (): string }, g: { (x: number): string } ): string {
return f() + g(123);
}
// ...and get an error if the return type is wrong
function b(f: { (): string }): number {
return f();
}
// ...or if the param type is wrong
function c(f: { (x: number): number }): number {
return f("hello");
}
// ...or if the arity is wrong
function d(f: { (x: number): number }): number {
return f();
}
// ...or if there is no call property
function e(f: {}): number {
return f();
}
// Make sure we complain even if the object literal is unsealed.
function f(): number {
var x = {};
return x();
}