Syntax Lookup

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

The @int decorator can be used with polymorphic variants and the @as decorator on externals to modify the compiled JavaScript to use integers for the values instead of strings.

Example

ReScriptJS Output
@val external setStatus: @int[
  @as(0) #NotStarted |
  @as(1) #Started |
  @as(2) #Done
] => unit = "setStatus"

setStatus(#Done)

References