-
Notifications
You must be signed in to change notification settings - Fork 12.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
React emit should have an '_extends' helper for spread attributes #7270
Comments
can you elaborate on the request, and why? |
We currently emit a call to |
My workaround: import {assign} from 'lodash';
(React as any).__spread = assign; Workaround without lodash: #7270 (comment) |
@kuon Thank you for the workaround. |
Yeah, but as I had lodash in my project, with typescript definition and all, it was easier. |
We’ll temporarily bring it back to avoid breaking everyone using TS: facebook/react#6444. However the method is deprecated and will go away in the next major release. |
Thanks so much @gaearon, we really appreciate the temporary rollback. |
Proper workaround without lodash: In a declare module 'object-assign' {
function Assign(target: any, source: any): any;
module Assign { }
export = Assign;
} In your main import * as assign from 'object-assign';
(React as any).__spread = assign; For clarity, you might want to add |
A fix is out in #7952. Ideally we can get the change into the next nightly. |
Just in case someone else wonders, ES6 (React as any).__spread = Object.assign; (but you need core-js or another polyfill if you're not targeting ES6). |
A fix should be out in our nightlies tonight. We'll potentially port the fix to our 1.8 branch. |
This should be fixed in TypeScript 1.8.10, which is now on npm and NuGet. |
Now that we have this for react, how about getting this for normal TypeScript (primarily because libraries out there e.g. : #2103 🌹 |
This is effectively a polyfill for
Object.assign
, and we should consider emitting the specific helper.The text was updated successfully, but these errors were encountered: