You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The above generated functions use `Js.t` object types. You can also hide this implementation detail by making the object type **abstract** by using the `newType` option with `@bs.deriving(jsConverter)`:
157
+
The above generated functions use JS object types. You can also hide this implementation detail by making the object type **abstract** by using the `newType` option with `@bs.deriving(jsConverter)`:
158
158
159
159
```res
160
160
@bs.deriving({jsConverter: newType})
@@ -298,7 +298,7 @@ As in similar use-cases before, you can also use `@bs.deriving({jsConverter: new
298
298
299
299
## Convert Record Type to Abstract Record
300
300
301
-
> **Note**: For ReScript >= v7, we recommend using [plain records to compile to JS objects](#records-as-objects).
301
+
> **Note**: For ReScript >= v7, we recommend using [plain records to compile to JS objects](bind-to-js-object#bind-to-record-like-js-objects).
302
302
> This feature might still be useful for certain scenarios, but the ergonomics might be worse
303
303
304
304
Use `@bs.deriving(abstract)` on a record type to expand the type into a creation, and a set of getter / setter functions for fields and methods.
@@ -567,9 +567,9 @@ let whisperCatName = {
567
567
}
568
568
```
569
569
570
-
## Convert External into `Js.t` Object Creation Function
570
+
## Convert External into JS Object Creation Function
571
571
572
-
Use `@bs.obj` on an `external` binding to create a function that, when called, will evaluate to a `Js.t` object with fields corresponding to the function's parameter labels.
572
+
Use `@bs.obj` on an `external` binding to create a function that, when called, will evaluate to a JS object with fields corresponding to the function's parameter labels.
573
573
574
574
This is very handy because you can make some of those labelled parameters optional and if you don't pass them in, the output object won't include the corresponding fields. Thus you can use it to dynamically create objects with the subset of fields you need at runtime.
575
575
@@ -602,7 +602,7 @@ external route: (
602
602
603
603
This function has four labelled parameters (the fourth one optional), one unlabelled parameter at the end (which we mandate for functions with [optional parameters](function#optional-labeled-arguments), and one parameter (`_method`) that requires an underscore prefix to avoid confusion with the ReScript keyword `method`.
604
604
605
-
Also of interest is the return type: `_`, which tells ReScript to automatically infer the full type of the `Js.t` object, sparing you the hassle of writing down the type manually!
605
+
Also of interest is the return type: `_`, which tells ReScript to automatically infer the full type of the JS object, sparing you the hassle of writing down the type manually!
## Generate Converters for `Js.t` Object and Record
141
+
## Generate Converters for JS Object and Record
142
142
143
143
> **Note:** In ReScript >= v7 [records are already compiled to JS
144
144
> objects](bind-to-js-object#bind-to-record-like-js-objects). `[@bs.deriving jsConverter]` is therefore
@@ -495,7 +495,7 @@ You can also use `[@bs.deriving {jsConverter: newType}]` to generate abstract ty
495
495
496
496
## Convert Record Type to Abstract Record
497
497
498
-
> **Note**: For ReScript >= v7, we recommend using [plain records to compile to JS objects](#records-as-objects).
498
+
> **Note**: For ReScript >= v7, we recommend using [plain records to compile to JS objects](bind-to-js-object#bind-to-record-like-js-objects).
499
499
> This feature might still be useful for certain scenarios, but the ergonomics might be worse
500
500
501
501
Use `[@bs.deriving abstract]` on a record type to expand the type into a creation, and a set of getter / setter functions for fields and methods.
@@ -928,7 +928,7 @@ let whisperCatName =
928
928
929
929
</CodeTab>
930
930
931
-
## Convert External into `Js.t` Object Creation Function
931
+
## Convert External into JS Object Creation Function
932
932
933
933
Use `@bs.obj` on an `external` binding to create a function that, when called, will evaluate to a `Js.t` object with fields corresponding to the function's parameter labels.
0 commit comments