Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove unboxed doc, point it to untagged variant #757

Merged
merged 4 commits into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions misc_docs/syntax/decorator_unboxed.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,16 @@ category: "decorators"
---

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

### Example

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

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

@unboxed
Expand All @@ -24,12 +25,16 @@ let hi = {message: "hello!"}
```

```js
var studentName = "Joe";
var myArray = ["hello", true, false, 13.37];
var hi = "hello!";
```

</CodeTab>

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

### References

* [Unboxed](/docs/manual/latest/unboxed)
* [Untagged variants doc](/docs/manual/latest/variant#untagged-variants)
* [Blog post introducing untagged variants](/blog/improving-interop)
* [Unboxed record](/docs/manual/v10.0.0/unboxed)
2 changes: 1 addition & 1 deletion pages/docs/manual/latest/interop-cheatsheet.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ This is a glossary with examples. All the features are described by later pages.
- [`@JSX`](jsx)
- `@react.component`: [here](/docs/react/latest/introduction) and [here](https://github.com/reasonml/reason-react)
- [`@warning`](attribute#usage)
- [`@unboxed`](unboxed)
- [`@unboxed`](variant#untagged-variants)

### Extension Points

Expand Down
157 changes: 0 additions & 157 deletions pages/docs/manual/latest/unboxed.mdx

This file was deleted.

Loading