Skip to content

Latest commit

 

History

History
34 lines (25 loc) · 773 Bytes

decorator_uncurry.mdx

File metadata and controls

34 lines (25 loc) · 773 Bytes
id keywords name summary category
uncurry-decorator
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 (.) => { ... }.

Example

<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
})

References