Skip to content

Commit 3a779bf

Browse files
author
Kevan Stannard
committed
Update unboxed
1 parent 7598d86 commit 3a779bf

File tree

1 file changed

+6
-29
lines changed

1 file changed

+6
-29
lines changed

misc_docs/syntax/decorator_unboxed.mdx

Lines changed: 6 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -6,35 +6,10 @@ summary: "This is the `@unboxed` decorator."
66
category: "decorators"
77
---
88

9-
The `@unboxed` decorator provides a way to unwrap **variant** constructors that have a *single* argument, or **record** objects that have a *single* field.
9+
The `@unboxed` decorator provides a way to unwrap **variant** constructors
10+
that have a *single* argument, or **record** objects that have a *single* field.
1011

11-
For example, consider the following code:
12-
13-
<CodeTab labels={["ReScript", "JS Output"]}>
14-
15-
```res
16-
type name = Name(string)
17-
let studentName = Name("Joe")
18-
19-
type greeting = {message: string}
20-
let hi = {message: "hello!"}
21-
```
22-
23-
```js
24-
var studentName = /* Name */{
25-
_0: "Joe"
26-
};
27-
28-
var hi = {
29-
message: "hello!"
30-
};
31-
```
32-
33-
</CodeTab>
34-
35-
When compiled to JavaScript, these values are represented as objects.
36-
37-
If we now add the `@unboxed` decorator, the object wrappers are removed from the JavaScript output:
12+
### Example
3813

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

@@ -55,4 +30,6 @@ var hi = "hello!";
5530

5631
</CodeTab>
5732

58-
See the [Unboxed](/docs/manual/latest/unboxed) section for more details.
33+
### References
34+
35+
* [Unboxed](/docs/manual/latest/unboxed)

0 commit comments

Comments
 (0)