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
Just came across this myself. React/babel have changed the way that spread attributes compile. Instead of relying on a utility function React.__spread, the transpiler now emits its own function that does the same job (i.e. merge all spread attributes into one object).
TypeScript should be updated to do the same, but in the mean time here's a polyfill that restores the old function and permits code compiled by TypeScript 1.8.9 to work:
// universal(Reactasany).__spread=function(target: any){for(vari=1;i<arguments.length;i++){varsource=arguments[i];for(varkeyinsource){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}returntarget;};// if you're compiling to ES6(Reactasany).__spread=Object.assign;
It's created by copying the function emitted by the latest babel transpiler so i figure it should work perfectly. Initial testing hasn't shown any issues.
TypeScript Version:
1.8.9
React Version:
15.0.0
Code
Actual behavior:
Browser console error "Uncaught TypeError: React.__spread is not a function".
The text was updated successfully, but these errors were encountered: