id | keywords | name | summary | category | ||
---|---|---|---|---|---|---|
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.
<CodeTab labels={["ReScript", "JS Output"]}>
@val external setStatus: @int[
@as(0) #NotStarted |
@as(1) #Started |
@as(2) #Done
] => unit = "setStatus"
setStatus(#Done)
setStatus(2);