Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upOptional delete must return true when base is nullish #10805
Closed
Comments
This comment has been minimized.
This comment has been minimized.
|
I can look at this! |
This comment has been minimized.
This comment has been minimized.
|
Sure, it's yours! |
This was referenced Dec 4, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bug Report
Current Behavior
When using optional delete to delete a property of a nullish base, the delete operation returns
undefined. It should returntrueInput Code
repl
Expected behavior/code
The
retvalue should betrue, notundefined.Babel Configuration (babel.config.js, .babelrc, package.json#babel, cli command, .eslintrc)
babel.config.js{ "plugins": ["@babel/plugin-proposal-optional-chaining"] }Possible Solution
When replacing optional deletes, we must use
t.booleanLiteral(true)in the consequent (truthy branch of a ternary expression) instead ofscope.buildUndefinedNode().Specifically, we must fix
babel/packages/babel-plugin-proposal-optional-chaining/src/index.js
Line 116 in d18afbd
Additional context/Screenshots
Add any other context about the problem here. If applicable, add screenshots to help explain.