From 5d1f958a7604b60e665a77dfb31cd5d0b54c79a0 Mon Sep 17 00:00:00 2001 From: Josh Vlk Date: Fri, 10 Apr 2026 13:00:59 -0400 Subject: [PATCH] docs(Stdlib): add details around None case for fromOption functions --- packages/@rescript/runtime/Stdlib_Null.resi | 3 ++- packages/@rescript/runtime/Stdlib_Nullable.resi | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/@rescript/runtime/Stdlib_Null.resi b/packages/@rescript/runtime/Stdlib_Null.resi index 1855cb2e116..c20f13142ba 100644 --- a/packages/@rescript/runtime/Stdlib_Null.resi +++ b/packages/@rescript/runtime/Stdlib_Null.resi @@ -104,11 +104,12 @@ external toOption: t<'a> => option<'a> = "#null_to_opt" /** Turns an `option` into a `Null.t`. `None` will be converted to `null`. +`None` compiles to `undefined`, but after calling `Null.fromOption`, the result will be `null` instead of `undefined`. ## Examples ```rescript let optString: option = None -let asNull = optString->Null.fromOption // Null.t +let asNull = optString->Null.fromOption // Null.t, will compile to 'null' Console.log(asNull == Null.null) // Logs `true` to the console. ``` */ diff --git a/packages/@rescript/runtime/Stdlib_Nullable.resi b/packages/@rescript/runtime/Stdlib_Nullable.resi index 1fbb44a314f..493e6a38ed9 100644 --- a/packages/@rescript/runtime/Stdlib_Nullable.resi +++ b/packages/@rescript/runtime/Stdlib_Nullable.resi @@ -102,6 +102,7 @@ external toOption: t<'a> => option<'a> = "#nullable_to_opt" /** Turns an `option` into a `Nullable.t`. +`None` compiles to `undefined` and after running `Nullable.fromOption` on it, it will continue to be `undefined`. ## Examples ```rescript