Skip to content

Commit 91fb835

Browse files
authored
docs(Stdlib): add details around None case for fromOption functions (#8333)
1 parent 548bfef commit 91fb835

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

packages/@rescript/runtime/Stdlib_Null.resi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,12 @@ external toOption: t<'a> => option<'a> = "#null_to_opt"
104104

105105
/**
106106
Turns an `option` into a `Null.t`. `None` will be converted to `null`.
107+
`None` compiles to `undefined`, but after calling `Null.fromOption`, the result will be `null` instead of `undefined`.
107108
108109
## Examples
109110
```rescript
110111
let optString: option<string> = None
111-
let asNull = optString->Null.fromOption // Null.t<string>
112+
let asNull = optString->Null.fromOption // Null.t<string>, will compile to 'null'
112113
Console.log(asNull == Null.null) // Logs `true` to the console.
113114
```
114115
*/

packages/@rescript/runtime/Stdlib_Nullable.resi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ external toOption: t<'a> => option<'a> = "#nullable_to_opt"
102102

103103
/**
104104
Turns an `option` into a `Nullable.t`.
105+
`None` compiles to `undefined` and after running `Nullable.fromOption` on it, it will continue to be `undefined`.
105106
106107
## Examples
107108
```rescript

0 commit comments

Comments
 (0)