Re:Runtime type information for JavaScript
by jw- on Sunday September 17, 2017 @07:42PM
(#15272332)
Really interesting stuff! I tried out some higher-order examples:
INPUT >>>
function add(f, b) {
return f(b);
};
let a = add(function(x) {return x + 1}, 3);
OUTPUT >>>
function add(f: function, b: number): number {
return f(b);
};
let a: number = add(function(x: number): number {return x + 1}, 3);
and I noticed that the flow type annotations are added to the call site, rather than on the argument f in the definition of add. Are all the types that you generate first order?
INPUT >>> function add(f, b) { return f(b); };
let a = add(function(x) {return x + 1}, 3);
OUTPUT >>> function add(f: function, b: number): number { return f(b); };
let a: number = add(function(x: number): number {return x + 1}, 3);
and I noticed that the flow type annotations are added to the call site, rather than on the argument f in the definition of add. Are all the types that you generate first order?