Skip to content

Commit 119edf3

Browse files
committed
Remove the remaining @bs. annotations
1 parent c6a7880 commit 119edf3

22 files changed

+85
-81
lines changed

misc_docs/syntax/decorator_get.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ The `@get` decorator is used to bind to a property of an object.
1414

1515
```res
1616
type window
17-
@bs.val external window: window = "window"
18-
@bs.get external getName: window => string = "name"
17+
@val external window: window = "window"
18+
@get external getName: window => string = "name"
1919
2020
let name = getName(window)
2121
```

misc_docs/syntax/decorator_obj.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ with properties that match the function's parameter labels.
1414
<CodeTab labels={["ReScript", "JS Output"]}>
1515

1616
```res
17-
@bs.obj
17+
@obj
1818
external action: (~name: string, unit) => _ = ""
1919
2020
let helloAction = action(~name="Hello")
@@ -32,4 +32,4 @@ function helloAction(param) {
3232

3333
### References
3434

35-
* [Convert External into JS Object Creation Function](/docs/manual/latest/generate-converters-accessors#convert-external-into-js-object-creation-function)
35+
* [Convert External into JS Object Creation Function](/docs/manual/latest/generate-converters-accessors#convert-external-into-js-object-creation-function)

misc_docs/syntax/decorator_send.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ The `@send` decorator is used to bind to a method on an object.
1414

1515
```res
1616
type document
17-
@bs.send external getElementById: (document, string) => Dom.element = "getElementById"
18-
@bs.val external doc: document = "document"
17+
@send external getElementById: (document, string) => Dom.element = "getElementById"
18+
@val external doc: document = "document"
1919
2020
let el = getElementById(doc, "myId")
2121
```
@@ -28,4 +28,4 @@ var el = document.getElementById("myId");
2828

2929
### References
3030

31-
* [Bind to JS Function](/docs/manual/latest/bind-to-js-function)
31+
* [Bind to JS Function](/docs/manual/latest/bind-to-js-function)

misc_docs/syntax/decorator_set.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ The `@set` decorator is used to set a property of an object.
1414

1515
```res
1616
type window
17-
@bs.val external window: window = "window"
18-
@bs.set external setName: (window, string) => unit = "name"
17+
@val external window: window = "window"
18+
@set external setName: (window, string) => unit = "name"
1919
2020
setName(window, "MyWindow")
2121
```

misc_docs/syntax/decorator_uncurry.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ In the following example we are binding to a function `map(arr, callback)` and u
1515
<CodeTab labels={["ReScript", "JS Output"]}>
1616

1717
```res
18-
@bs.send
18+
@send
1919
external map: (array<'a>, @uncurry ('a => 'b)) => array<'b> = "map"
2020
2121
let result = map([1, 2, 3], x => x + 1)

pages/docs/gentype/latest/supported-types.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ If one field of the ReScript record has option type, this is exported to an opti
5151
ReScript object values of type e.g. `{. "x":int}` such as `{"x": 0}`, `{"x": 1}`, `{"x": 2}`, are exported as identical JS object values `{x:0}`, `{x:1}`, `{x:2}`. This requires no conversion. So they are exported to JS values of type `{x:number}`.
5252
A conversion is required only when the type of some field requires conversions.
5353

54-
Since objects are immutable by default, their fields will be exported to readonly property types in Flow/TS. Mutable fields are specified in ReScript by e.g. `{. [@bs.set] "mutableField": string }`.
54+
Since objects are immutable by default, their fields will be exported to readonly property types in Flow/TS. Mutable fields are specified in ReScript by e.g. `{ @set "mutableField": string }`.
5555

5656
It is possible to mix object and option types, so for example the ReScript type `{. "x":int, "y":option(string)}` exports to JS type `{x:number, ?y: string}`, requires no conversion, and allows option pattern matching on the ReScript side.
5757

pages/docs/manual/latest/api/dom/storage.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ external length: t => int = "length"
4545
## localStorage
4646

4747
```res sig
48-
@bs.val external localStorage: t = "localStorage"
48+
@val external localStorage: t = "localStorage"
4949
```
5050

5151
## sessionStorage
5252

5353
```res sig
54-
@bs.val external sessionStorage: t = "sessionStorage"
54+
@val external sessionStorage: t = "sessionStorage"
5555
```

pages/docs/manual/latest/api/dom/storage2.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,11 @@ external length: t => int = "length"
5151
## localStorage
5252

5353
```res sig
54-
@bs.val external localStorage: t = "localStorage"
54+
@val external localStorage: t = "localStorage"
5555
```
5656

5757
## sessionStorage
5858

5959
```res sig
60-
@bs.val external sessionStorage: t = "sessionStorage"
60+
@val external sessionStorage: t = "sessionStorage"
6161
```

pages/docs/manual/latest/converting-from-js.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ Now this triggers the next type error, that `school` isn't found. Let's use [`ex
188188
<CodeTab labels={["ReScript", "JS Output"]}>
189189

190190
```res example
191-
@bs.module external school: 'whatever = "school"
191+
@module external school: 'whatever = "school"
192192
193193
let defaultId = 10
194194
@@ -242,8 +242,8 @@ type payload = {
242242
student: student
243243
}
244244
245-
@bs.module external school: school = "school"
246-
@bs.send external getStudentById: (school, int) => student = "getStudentById"
245+
@module external school: school = "school"
246+
@send external getStudentById: (school, int) => student = "getStudentById"
247247
248248
let defaultId = 10
249249

pages/docs/manual/latest/external.mdx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,16 @@ canonical: "/docs/manual/latest/external"
2424

2525
</CodeTab>
2626

27-
There are several kinds of `external`s, differentiated and/or augmented through the `@bs` notation they carry. This page deals with the general, shared mechanism behind most `external`s. The different `@bs` annotations are documented in their respective pages later. A few notable ones:
27+
There are several kinds of `external`s, differentiated and/or augmented through the [attribute](attribute.md) they carry. This page deals with the general, shared mechanism behind most `external`s. The different are documented in their respective pages later. A few notable ones:
2828

2929
- `@val`, `@scope`: [bind to global JS values](bind-to-global-js-values).
3030
- `@module`: [bind to JS imported/exported values](import-from-export-to-js).
3131
- `@send`: [bind to JS methods](bind-to-js-function).
3232

33+
You can also use our [Syntax Lookup](/syntax-lookup) tool to find them.
34+
35+
Related: see also our [list of external decorators](interop-cheatsheet#list-of-decorators).
36+
3337
## Usage
3438

3539
Once declared, you can use an `external` as a normal value, just like a let binding.

0 commit comments

Comments
 (0)