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