-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Closed
Description
TypeScript Version: 3.7.3 + online playground
Search Terms: spread, rest, object assign
Code
// A *self-contained* demonstration of the problem follows...
import arrayMutators from 'final-form-arrays';
const FormWithRedirect = ({
mutators = { ...arrayMutators },
...props
}) => {
console.log(mutators)
};
export default FormWithRedirect;Expected behavior:
The spread operator in the default value for mutators ({ ...arrayMutators }) should be transpiled to Object.assign when the compilation target is ES5.
Actual behavior:
The transpiled code includes a spread operator, which isn't valid ES5:
var final_form_arrays_1 = __importDefault(require("final-form-arrays"));
var FormWithRedirect = function (_a) {
var _b = _a.mutators, mutators = _b === void 0 ? { ...final_form_arrays_1.default } : _b, props = __rest(_a, ["mutators"]);
console.log(mutators);
};
exports.default = FormWithRedirect;Related Issues: None
RyanCavanaugh, SlurpTheo and prolidorpenrvapiroldon
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScript