Skip to content

Commit 7209fc4

Browse files
committed
Update and link all the decorators in the cheat sheet
1 parent 8b87323 commit 7209fc4

File tree

3 files changed

+50
-26
lines changed

3 files changed

+50
-26
lines changed

data/sidebar_manual_latest.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
"reserved-keywords"
3535
],
3636
"JavaScript Interop": [
37+
"interop-cheatsheet",
3738
"embed-raw-javascript",
3839
"shared-data-types",
3940
"external",
@@ -45,8 +46,7 @@
4546
"inlining-constants",
4647
"use-illegal-identifier-names",
4748
"generate-converters-accessors",
48-
"browser-support-polyfills",
49-
"interop-cheatsheet"
49+
"browser-support-polyfills"
5050
],
5151
"Build System": [
5252
"build-overview",

pages/docs/manual/latest/interop-cheatsheet.mdx

+47-23
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,53 @@ canonical: "/docs/manual/latest/interop-cheatsheet"
66

77
# Interop Cheatsheet
88

9-
<!-- TODO: this should be a glossary instead -->
9+
This is a glossary with examples. All the features are described by later pages.
10+
11+
## List of Decorators
12+
13+
<!-- Synced from https://github.com/rescript-lang/syntax/blob/123760c5a264da5288eeee5213ddd25eb86d62fe/src/res_printer.ml#L19-L51 -->
14+
15+
### Attributes
16+
17+
- `@bs.as`: [here](attribute#usage), [here](bind-to-js-function#fixed-arguments), [here](bind-to-js-function#constrain-arguments-better) and [here](generate-converters-accessors#usage-3)
18+
- [`@bs.deriving`](generate-converters-accessors#generate-functions--plain-values-for-variants)
19+
- [`@bs.get`](bind-to-js-object#bind-using-special-bs-getters--setters)
20+
- [`@bs.get_index`](bind-to-js-object#bind-using-special-bs-getters--setters)
21+
<!-- - `@bs.ignore` -->
22+
- [`@bs.inline`](inlining-constants)
23+
- [`@bs.int`](bind-to-js-function#constrain-arguments-better)
24+
<!-- - `@bs.meth` -->
25+
- [`@bs.module`](import-from-export-to-js#import-a-javascript-modules-content)
26+
- [`@bs.new`](bind-to-js-object#bind-to-a-js-object-thats-a-class)
27+
- [`@bs.obj`](generate-converters-accessors#convert-external-into-js-object-creation-function)
28+
- [`@bs.optional`](generate-converters-accessors#optional-labels)
29+
- [`@bs.return`](bind-to-js-function#function-nullable-return-value-wrapping)
30+
- `@bs.send`: [here](bind-to-js-function#object-method) and [here](pipe#js-method-chaining)
31+
- [`@bs.scope`](bind-to-global-js-values#global-modules)
32+
- [`@bs.set`](bind-to-js-object#bind-using-special-bs-getters--setters)
33+
- [`@bs.set_index`](bind-to-js-object#bind-using-special-bs-getters--setters)
34+
- [`@bs.variadic`](bind-to-js-function#variadic-function-arguments)
35+
- [`@bs.string`](bind-to-js-function#constrain-arguments-better)
36+
- [`@bs.this`](bind-to-js-function#modeling-this-based-callbacks)
37+
- [`@bs.uncurry`](bind-to-js-function#extra-solution)
38+
- [`@bs.unwrap`](bind-to-js-function#trick-2-polymorphic-variant--bsunwrap)
39+
- [`@bs.val`](bind-to-global-js-values#global-modules)
40+
41+
- [`@deprecated`](attribute#usage)
42+
- [`genType`](https://github.com/reason-association/genType)
43+
- [`@JSX`](jsx)
44+
- `@react.component`: [here](/docs/react/latest/introduction) and [here](https://github.com/reasonml/reason-react)
45+
- [`@warning`](attribute#usage)
46+
- [`@unboxed`](unboxed)
47+
48+
### Extension Points
49+
50+
- [`%debugger`](embed-raw-javascript#debugger)
51+
- [`%external`](bind-to-global-js-values#special-global-values)
52+
<!-- - `%node` -->
53+
<!-- - `%obj` -->
54+
- [`%raw`](embed-raw-javascript#paste-raw-js-code)
55+
- [`%re`](primitive-types#regular-expression)
1056

1157
## Raw JS
1258

@@ -199,25 +245,3 @@ var gpa = 2.1 + 10;
199245
```
200246

201247
</CodeTab>
202-
203-
## List of `@bs` Decorators
204-
205-
- `@bs.as`
206-
- `@bs.get`
207-
- `@bs.get_index`
208-
- `@bs.inline`
209-
- `@bs.int`
210-
- `@bs.meth`
211-
- `@bs.module`
212-
- `@bs.new`
213-
- `@bs.return`
214-
- `@bs.scope`
215-
- `@bs.send`
216-
- `@bs.set`
217-
- `@bs.set_index`
218-
- `@bs.string`
219-
- `@bs.this`
220-
- `@bs.uncurry`
221-
- `@bs.unwrap`
222-
- `@bs.val`
223-
- `@bs.variadic`

pages/docs/manual/latest/pipe.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ asyncRequest()
8787
.send();
8888
```
8989

90-
Assuming we don't need the chaining behavior above, we'd bind to each case this using `bs.send` from the previous section:
90+
Assuming we don't need the chaining behavior above, we'd bind to each case this using `bs.send` from the aforementioned binding API page:
9191

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

0 commit comments

Comments
 (0)