Given these types:
type Bar = number;
type Foo = {
bar: Bar,
};
And this point-free conversion function fooToBar
:
import { prop } from 'ramda';
const fooToBar = prop('bar');
Is it possible to annotate fooToBar
's signature of Foo -> Bar
?
The function type annotation docs are pretty detailed. It looks like the following should work for you
/* @flow */
type Bar = number;
type Foo = {
bar: Bar,
};
const prop = y => x => x[y];
const fooToBar : Foo => Bar = prop('bar');
No errors!