id | keywords | name | summary | category | ||
---|---|---|---|---|---|---|
uncurry-decorator |
|
@uncurry |
This is the `@uncurry` decorator. |
decorators |
The @uncurry
decorator allows you to annotate external function callback argument types
so when writing the callbacks they may be declared as normal functions () => { ... }
rather than needing the uncurried function syntax (.) => { ... }
.
<CodeTab labels={["ReScript", "JS Output"]}>
@bs.send
external map: (array<'a>, @uncurry ('a => 'b)) => array<'b> = "map"
let result = map([1, 2, 3], x => x + 1)
var result = [1, 2, 3].map(function (x) {
return (x + 1) | 0
})