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 @unboxed decorator.

The @unboxed decorator provides a way to unwrap variant constructors that have no overlap in their runtime representation, or record objects that have a single field.

Example

ReScriptJS Output
@unboxed
type listItemValue = String(string) | Boolean(bool) | Number(float)
let myArray = [String("Hello"), Boolean(true), Boolean(false), Number(13.37)]
let studentName = Name("Joe")

@unboxed
type greeting = {message: string}
let hi = {message: "hello!"}

@unboxed for variants with multiple constructors is available since ReScript 11.0.0.

References

  • Untagged variants doc

  • Blog post introducing untagged variants

  • Unboxed record

© 2025 The ReScript Project

About
  • Community
  • ReScript Association
Find us on