Skip to content

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

Merged
nicolo-ribaudo merged 1 commit intobabel:masterfrom
mpaarating:issues/10805-optional-delete-must-return-true
Dec 4, 2019
Merged

fix(optional chaining): Optional delete returns true with nullish base#10806
nicolo-ribaudo merged 1 commit intobabel:masterfrom
mpaarating:issues/10805-optional-delete-must-return-true

Conversation

@mpaarating
Copy link
Copy Markdown
Contributor

@mpaarating 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;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent!

Copy link
Copy Markdown
Member

@nicolo-ribaudo nicolo-ribaudo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

outdated A closed issue/PR that is archived due to age. Recommended to make a new issue PR: Bug Fix 🐛 A type of pull request used for our changelog categories Spec: Optional Chaining

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Optional delete must return true when base is nullish

4 participants