Skip to content

Latest commit

 

History

History
35 lines (24 loc) · 721 Bytes

decorator_int.mdx

File metadata and controls

35 lines (24 loc) · 721 Bytes
id keywords name summary category
int-decorator
int
decorator
@int
This is the `@int` decorator.
decorators

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

<CodeTab labels={["ReScript", "JS Output"]}>

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

setStatus(#Done)
setStatus(2);

References