-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
[1.3] check
's Match.Optional now allows "null" (contrary to plan)
#6735
Comments
`Match.Optional` is still only supposed to "pass" if the value is `null` or the specified type. The new `Match.Maybe` allows `undefined` or `null` in addition to the specified types. `Match.Optional` is on the track toward deprecation, however to not break existing code it was *supposed* to stay working the same as before. (per meteor#3876). There weren't tests in place to make sure that `Match.Optional` kept working the same, and the code didn't actually make it keep working the same. Hopefully extra tests will make this better. `.Maybe` has some additional bugs, but should be addressed separately (see meteor#6271) Fixes meteor#6735
I appreciate filing the issue before opening the PR! |
No problem! |
Hmm, I don't really know that we have a strict preference at the moment. |
`Match.Optional` is still only supposed to "pass" if the value is `null` or the specified type. The new `Match.Maybe` allows `undefined` or `null` in addition to the specified types. `Match.Optional` is on the track toward deprecation, however to not break existing code it was *supposed* to stay working the same as before. (per #3876). There weren't tests in place to make sure that `Match.Optional` kept working the same, and the code didn't actually make it keep working the same. Hopefully extra tests will make this better. `.Maybe` has some additional bugs, but should be addressed separately (see #6271) Fixes #6735
@abernix let's stick with separate issues/PRs otherwise it may get confusing in categorization. |
As found during research for the problem in #6712,
Match.Optional
now matchesnull
when it had not before 1.3. The (ultimate) decision in Issue #3876 was to keepMatch.Optional
the same (allowundefined
) and introduce a newMatch.Maybe
which would matchnull
andundefined
in order to NOT do this:Unfortunately, the way that that #6220 was done, it literally did exactly that, and there was no Match test in place to make sure that
null
did not passMatch.Optional
.I have an incoming PR to fix this. This Issue is just for the record.
The text was updated successfully, but these errors were encountered: