You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
React emit should have an '_extends' helper for spread attributes #7270
We currently emit a call to React.__spread which has been deprecated for a while now (and might be gone soon?). The official JSX transformer calls _extends which is initialized with Object.assign || (object.assign polyfill)
We’ll temporarily bring it back to avoid breaking everyone using TS: react/react#6444. However the method is deprecated and will go away in the next major release.
Reacted by Joshua Harms, Sean Vieira, Vincent Taverna and Abhishek Hingnikar
changed the title [-]React emit should have an '_extends' helper for spread attribute[/-][+]React emit should have an '_extends' helper for spread attributes[/+]on Apr 8, 2016
Now that we have this for react, how about getting this for normal TypeScript (primarily because libraries out there e.g. redux love it) {...foo,{withSomethingMore}}
Activity
mhegazy commentedon Feb 26, 2016
can you elaborate on the request, and why?
RyanCavanaugh commentedon Feb 26, 2016
We currently emit a call to
React.__spreadwhich has been deprecated for a while now (and might be gone soon?). The official JSX transformer calls_extendswhich is initialized withObject.assign || (object.assign polyfill)kuon commentedon Apr 7, 2016
__spreadis gone in react 15.0. which means typescript 1.8.9 cannot compile TSX with react 15.0.My workaround:
Workaround without lodash: #7270 (comment)
gaearon commentedon Apr 7, 2016
Nicolas Goy (@kuon) Thank you for the workaround.
I would suggest using
object-assignnpm module directly. It is what React uses in 15.kuon commentedon Apr 7, 2016
Yeah, but as I had lodash in my project, with typescript definition and all, it was easier.
gaearon commentedon Apr 7, 2016
We’ll temporarily bring it back to avoid breaking everyone using TS: react/react#6444. However the method is deprecated and will go away in the next major release.
DanielRosenwasser commentedon Apr 7, 2016
Thanks so much dan (@gaearon), we really appreciate the temporary rollback.
kuon commentedon Apr 7, 2016
Proper workaround without lodash:
In a
*.d.tsfile, add:In your main
*.tsfile, reference your lib file and add:For clarity, you might want to add
object-assignas an explicit dependency in yourpackage.jsonuntil this is fixed.DanielRosenwasser commentedon Apr 8, 2016
A fix is out in #7952. Ideally we can get the change into the next nightly.
[-]React emit should have an '_extends' helper for spread attribute[/-][+]React emit should have an '_extends' helper for spread attributes[/+]jgillich commentedon Apr 8, 2016
Just in case someone else wonders, ES6
Object.assignworks as well:(but you need core-js or another polyfill if you're not targeting ES6).
DanielRosenwasser commentedon Apr 8, 2016
A fix should be out in our nightlies tonight. We'll potentially port the fix to our 1.8 branch.
DanielRosenwasser commentedon Apr 12, 2016
This should be fixed in TypeScript 1.8.10, which is now on npm and NuGet.
basarat commentedon Apr 13, 2016
Now that we have this for react, how about getting this for normal TypeScript (primarily because libraries out there e.g.
reduxlove it){...foo,{withSomethingMore}}: #2103 🌹