DocsPlaygroundBlogCommunityPackages
  • Playground
  • Blog
  • Community
  • Packages
  • X
  • Bluesky
  • GitHub
  • Forum
Language ManualAPISyntax LookupReact

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

  • Constrain Arguments Better

© 2025 The ReScript Project

About
  • Community
  • ReScript Association
Find us on