Syntax Lookup

Enter some language construct you want to know more about.
This is the @unwrap decorator.

The @unwrap decorator may be used when binding to external functions that accept multiple types for an argument.

Example

ReScriptJS Output
@val external padLeft: (
  @unwrap [#Int(int) | #Str(string)],
  string
) => string = "padLeft";

let result1 = padLeft(#Int(7), "eleven");
let result2 = padLeft(#Str("7"), "eleven");

References