Skip to content
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

fix(optional chaining): Optional delete returns true with nullish base #10806

Conversation

@mpaarating
Copy link
Contributor

mpaarating commented Dec 4, 2019

Q                       A
Fixed Issues? Fixes #10805
Patch: Bug Fix?
Major: Breaking Change?
Minor: New Feature?
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes?
License MIT

Per issue #10805, the return value when using delete on a nullish base is
currently undefined. The correct return type should be true.

Per issue 10805, the return value when using delete on a nullish base is
currently undefined. The correct return type should be true.
test = obj === null || obj === void 0 ? void 0 : delete obj.a.b;
test = obj === null || obj === void 0 ? void 0 : (_obj$b = obj.b) === null || _obj$b === void 0 ? void 0 : delete _obj$b.b;
obj === null || obj === void 0 ? void 0 : delete obj.a;
let test = obj === null || obj === void 0 ? true : (_obj$a = obj.a) === null || _obj$a === void 0 ? true : delete _obj$a.b;

This comment has been minimized.

Copy link
@jridgewell

jridgewell Dec 4, 2019

Member

Excellent!

Copy link
Member

nicolo-ribaudo left a comment

Thanks!

@nicolo-ribaudo nicolo-ribaudo merged commit bb6cc61 into babel:master Dec 4, 2019
5 checks passed
5 checks passed
Travis CI - Pull Request Build Passed
Details
codecov/project 88.14% (target 80%)
Details
e2e Workflow: e2e
Details
test Workflow: test
Details
test262 Workflow: test262
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.