Hoist omitted keys from object spread operator (#13384)
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
const _excluded = ["text", "className", "id"];
|
||||
|
||||
function render(_ref) {
|
||||
var _Component;
|
||||
|
||||
let text = _ref.text,
|
||||
className = _ref.className,
|
||||
id = _ref.id,
|
||||
props = babelHelpers.objectWithoutProperties(_ref, ["text", "className", "id"]);
|
||||
props = babelHelpers.objectWithoutProperties(_ref, _excluded);
|
||||
// intentionally ignoring props
|
||||
return () => _Component || (_Component = <Component text={text} className={className} id={id} />);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
const _excluded = ["text", "className", "id"];
|
||||
|
||||
function render(_ref) {
|
||||
let text = _ref.text,
|
||||
className = _ref.className,
|
||||
id = _ref.id,
|
||||
props = babelHelpers.objectWithoutProperties(_ref, ["text", "className", "id"]);
|
||||
props = babelHelpers.objectWithoutProperties(_ref, _excluded);
|
||||
return () => <Component text={text} className={className} id={id} {...props} />;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
const _excluded = ["outsetArrows"];
|
||||
|
||||
function Foo(_ref) {
|
||||
var _div;
|
||||
|
||||
let {
|
||||
outsetArrows
|
||||
} = _ref,
|
||||
rest = babelHelpers.objectWithoutProperties(_ref, ["outsetArrows"]);
|
||||
rest = babelHelpers.objectWithoutProperties(_ref, _excluded);
|
||||
return useMemo(() => _div || (_div = <div outsetArrows={outsetArrows} />), [outsetArrows]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user