Skip to content

Commit c83d22f

Browse files
committed
Misc doc updates
1 parent a296baa commit c83d22f

File tree

6 files changed

+7
-10
lines changed

6 files changed

+7
-10
lines changed

pages/docs/manual/latest/api/js/obj.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Js.log(target)
5151
## keys
5252

5353
```res sig
54-
let keys: Js.t<'a> => array<string>
54+
let keys: {..} => array<string>
5555
```
5656

5757
`keys(obj)` returns an `array` of the keys of `obj`'s own enumerable properties.

pages/docs/manual/latest/import-from-export-to-js.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ var paddedResult = LeftPad("hi", 5);
7676

7777
Depending on whether you're compiling ReScript to CommonJS or ES6 module, **this feature will generate subtly different code**. Please check both output tabs to see the difference. The ES6 output here would be wrong!
7878

79-
### Import an ES6 Default Export (Since >= 8.3.0)
79+
### Import an ES6 Default Export
8080

8181
Use the value `"default"` on the right hand side:
8282

pages/docs/manual/latest/migrate-from-bucklescript-reason.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ npx rescript convert -all
5656
- First class module: from `(module S: Student)` to `module(S: Student)`.
5757
- No custom infix operator for now (including `mod`).
5858
- Object access: from `settings##visible #= true` to `settings["visible"] = true`. Rejoice!
59-
- Object: from `Js.t({"age": int})` to just `{"age": int}`. The `Js.t` part is now implicit.
59+
- Object: from `Js.t({"age": int})` to just `{"age": int}`. The `Js.t` part is now uneeded.
6060
- Attribute: from `[@myAttribute "hello"]` to `@myAttribute("hello")`. From `[%re bla]` to `%re(bla)`.
6161
- Removed dereference syntax `result^`. Just use `result.contents`.
6262
- `fun` pattern matching syntax removed.

pages/docs/manual/latest/pattern-matching-destructuring.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -747,7 +747,7 @@ Here are some advices.
747747

748748
Do not abuse the wildcard `_` too much. This prevents the compiler from giving you better exhaustiveness check, which would be especially important after a refactoring where you add a new case to a variant. Try only using `_` against infinite possibilities, e.g. string, int, etc.
749749

750-
Use `when` clause sparingly.
750+
Use `if` clause sparingly.
751751

752752
**Flatten your pattern-match whenever you can**. This is a real bug remover. Here's a series of examples, from worst to best:
753753

pages/docs/manual/latest/reserved-keywords.mdx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ canonical: "/docs/manual/latest/reserved-keywords"
2424

2525
<!-- - `do` -->
2626
<!-- - `done` -->
27-
- `downto`
2827

2928

3029
- `else`
@@ -79,7 +78,6 @@ canonical: "/docs/manual/latest/reserved-keywords"
7978

8079

8180
<!-- - `then` -->
82-
- `to`
8381
- `true`
8482
- `try`
8583
- `type`

pages/docs/manual/latest/shared-data-types.mdx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,14 @@ Unlike most compiled-to-js languages, in ReScript, **you don't need to write dat
2222
- Object. ReScript objects are JavaScript objects, vice-versa.
2323
- Function. They compile to clean JS functions.
2424
- Module. ReScript files are considered top-level modules, and are compiled to JS files 1 to 1. Nested modules are compiled to JavaScript objects.
25-
- Unit. The `unit` type, which has a single value `()`, compiles to `undefined` too. Likewise, you can treat an incoming JS `undefined` as `()`.
26-
27-
<!-- TODO: talk about poly variant -->
25+
- Polymorphic variants.
26+
- Unit. The `unit` type, which has a single value `()`, compiles to `undefined` too. Likewise, you can treat an incoming JS `undefined` as `()` if that's the only value it'll ever be.
2827

2928
**Types that are slightly different than JS, but that you can still use from JS**:
3029
- Int. **Ints are 32-bits**! Be careful, you can potentially treat them as JS numbers and vice-versa, but if the number's large, then you better treat JS numbers as floats. For example, we bind to Js.Date using `float`s.
3130
- Option. The `option` type's `None` value compiles into JS `undefined`. The `Some` value, e.g. `Some(5)`, compiles to `5`. Likewise, you can treat an incoming JS `undefined` as `None`. **JS `null` isn't handled here**. If your JS value can be `null`, use [Js.Nullable](api/js/nullable) helpers.
3231
- Exception.
33-
- Variant. Check the compiled JavaScript output of variant to see its shape. We don't recommend exporting a ReScript variant for pure JS usage, but you can do that if you have some interop needs.
32+
- Variant. Check the compiled JavaScript output of variant to see its shape. We don't recommend exporting a ReScript variant for pure JS usage, since they're harder to read as plain JS code, but you can do it.
3433
- List, which is just a regular variant.
3534

3635
**Non-shared types (aka internal types)**:

0 commit comments

Comments
 (0)