-
Notifications
You must be signed in to change notification settings - Fork 469
Rename Nullable to Nullish #6533
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
What do you think? |
The word "nullish" has never been adopted by the ecosystem. I think that would be a little strange. The words I see the most are "maybe" or "optional". |
With the nullish coalescing operator I'd expect it to be pretty understandable. I don't think this is a big issue since I think it is reasonable that some of these modules could be removed and made more consistent: let _: Js.null<'a> = Js.null
let _: Js.Null.t<'a> = Js.Null.empty
let _: Js.undefined<'a> = Js.undefined
let _: Js.Undefined.t<'a> = Js.Undefined.empty
let _: option<'a> = None
let _: Js.null_undefined<'a> = Js.Null_undefined.null
let _: Js.null_undefined<'a> = Js.Null_undefined.undefined
let _: Js.Nullable.t<'a> = Js.Nullable.null
let _: Js.Nullable.t<'a> = Js.Nullable.undefined And being able to easily pattern match would be big. |
It is called as nullable for even TypeScript people: https://www.typescriptlang.org/docs/handbook/utility-types.html#nonnullabletype Maybe we can remove something inconsistent, but I don't think the "nullable" is not a problem |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
I find the
Nullable
module name very confusing because usually, it's'a | null,
not'a | undefined | null
It's not super critical to me, but I think for ReScript's future, it will be better to rename it toNullish
early on (at least do it in rescript-core).According to https://tc39.es/ecma262/

nullish
is precisely the values that can be bothnull
andundefined
.Because right now for users coming from JS/TS there's the following situation:
I think that we shouldn't do anything with
option
andnull
; that's the language specific. But the problem is that usually nullable meansT | null
instead ofT | undefined | null
.The text was updated successfully, but these errors were encountered: