Syntax Lookup

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

The @string decorator can be used with polymorphic variants and the @as decorator on externals to modify the string values used for the variants in the compiled JavaScript.

Example

ReScriptJS Output
@val external setStatus: @string[
  @as("NOT_STARTED") #NotStarted |
  @as("STARTED") #Started |
  @as("DONE") #Done
] => unit = "setStatus"

setStatus(#NotStarted)

References