flow
flow copied to clipboard
Type argument can't be referenced inside function
I believe this is a known issue, but I couldn't find an existing issue for it.
/* @flow */
var constant = function<U>(u: U) {
return function(): U {
return u;
}
}
Results in:
test.js|4 col 22 error| identifier U
|| Unknown global name
||
FWIW, this does work:
/* @flow */
type Constant<T> = () => T;
function constant<T>(x: T): Constant<T> {
return function() {
return x;
}
}
Definitely a known issue. :) Thanks!
Looks like this is fixed in 0.5.0
I lied. Still broken in 0.5.0
This is a duplicate of #160