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

// You should be able to use a function as an object with a call property
var a: { (x: number): string } = function (x: number): string { return "hi"; };
// ...and it should notice when the return type is wrong
var b: { (x: number): number } = function (x: number): string { return "hi"; };
// ...or if the param type is wrong
var c: { (x: string): string } = function (x: number): string { return "hi"; };
// ...or if the arity is wrong
var d: { (): string } = function (x: number): string { return "hi"; };
// ...but subtyping rules still apply
var e: { (x: any): void } = function() { } // arity
var f: { (): mixed } = function(): string { return "hi" } // return type
var g: { (x: string): void } = function(x: mixed) { } // param type
// A function can be an object
var y : {} = function (x: number): string { return "hi"; };
var z : Object = function (x: number): string { return "hi"; };