Perfect your code
With built-in code review tools, GitHub makes it easy to raise the quality bar before you ship. Join the 40 million developers who've merged over 200 million pull requests.
Sign up for free See pricing for teams and enterprisespreset-env: Edge support for arrow param destructuring #8926
Conversation
This comment has been minimized.
This comment has been minimized.
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/9282/ |
This comment has been minimized.
This comment has been minimized.
FWIW, I published this to npm as |
This comment has been minimized.
This comment has been minimized.
@benmosher thanks! |
* master: (222 commits) Set correct methods name Use toPropertyKey in the "decorate" helper Allow function types in type params within arrow return types (babel#8954) Fix message when plugin of a wrong type is passed (babel#8950) rename colliding let bindings with for loop init (babel#8937) edge incomplete support for arrow destructuring (babel babel#8349) (babel#8926) fix single-arg async arrows when retainLines=true (babel#8868) [flow] Explicit inexact objects with `...` (babel#8884) Update preset-env data (babel#8898) Treat break inside block inside loop (babel#8914) fixed "source map" formatting in comment (babel#8878) [skip ci] fix typo in contributing guidelines (babel#8901) [skip ci] fix: Expression x === 'y' && '' should not evaluate to undefined. (babel#8880) fixed an extra word Fixes babel#8865 (babel#8866) v7.1.4 v7.1.3 Bump Babel deps (babel#8770) flow-bin@0.82.0 (babel#8832) Insertafter jsx fix (babel#8833) ... # Conflicts: # packages/babel-parser/src/tokenizer/index.js # packages/babel-parser/test/fixtures/experimental/class-private-properties/failure-numeric-literal/options.json # packages/babel-parser/test/fixtures/experimental/pipeline-operator/invalid-proposal/options.json
This comment has been minimized.
This comment has been minimized.
JSteunou
commented
Nov 13, 2018
@benmosher & @existentialism I think this PR introduced a regression, can you look at #9020 (comment) please ? |
This comment has been minimized.
This comment has been minimized.
JSteunou
commented
Nov 13, 2018
•
|
This comment has been minimized.
This comment has been minimized.
JSteunou
commented
Nov 13, 2018
My bad, it supports it only if there are no previous parameters, issue is still valid This is supported (({b = 0, c = 3}) => {
return b === 2 && c === 3;
})({b: 2}); this is not supported ((a, {b = 0, c = 3}) => {
return a === 1 && b === 2 && c === 3;
})(1, {b: 2});``` |
This comment has been minimized.
This comment has been minimized.
@JSteunou is it possible to do the transpilation in a finer-grained way? AFAICT it's just the one plugin package that handles both fixing this issue but also has the |
This comment has been minimized.
This comment has been minimized.
adrienharnay
commented
Dec 10, 2018
•
Hey, just ran into this. Using @babel/preset-env 7.1.6, and basically it outputs this using class User_User extends react_default.a.Component {
constructor() {
var _this;
_this = super(...arguments);
User_defineProperty(this, "onClick", () => {
if (!this.props.user) {
this.props.doSomething();
}
});
User_defineProperty(this, "render", function () {
let optionalArg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'false';
// this line crashes on Edge 17.1734 (latest at this moment)
const _this$props = _this.props,
user = _this$props.user;
});
}
render() {
const user = this.props.user;
return react_default.a.createElement("div");
}
} Is there any work on this at the moment? Any workaround in the meantime? Thanks in advance! |
benmosher commentedOct 24, 2018
Added the as-yet-Edge-unsupported arrow function parameter destructuring as a feature supported by
transform-parameters
, per compat-table.