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
Adopt object spread and polyfill Object.assign #8283
However, if we polyfilled Object.assign in IE, we could switch to object spread ({...obj}) syntax across the code base, which provides many benefits:
An easier to read, more concise syntax.
When we ditch IE11 support in future and start providing an untranspiled build, we'll get better performance for free because native spreads are faster than Object.assign.
Strictly typing extend and all code that uses it in Flow is really hard, which I discovered while working on Start adopting Flow strict mode #8281. It's much easier with spreads because it syntactically indicates the full shape of an object from the start — no type conversions/refinements need to happen to transform an object through multiple extensions.
@asheemmamoowala what this does is tell Buble to transpile object spreads to Object.assign calls. But this will break IE11 because it doesn't have Object.assign. To make this work, we need to include a polyfill in the bundle.
The issue here is no longer IE11 since GL JS no longer supports it, but some build systems fail when encountering the Object spread notation. See #11266 for an example. We probably don't need to polyfill Object.assign either.
Activity
asheemmamoowala commentedon May 28, 2019
Isn't this already done automatically in our rollup configuration at :
mapbox-gl-js/build/rollup_plugins.js
Line 20 in 42f00ac
mourner commentedon May 29, 2019
@asheemmamoowala what this does is tell Buble to transpile object spreads to
Object.assigncalls. But this will break IE11 because it doesn't haveObject.assign. To make this work, we need to include a polyfill in the bundle.karimnaaji commentedon Dec 8, 2020
Addressed as part of the IE11 deprecation in v2.
ryanhamley commentedon Jan 26, 2022
The issue here is no longer IE11 since GL JS no longer supports it, but some build systems fail when encountering the Object spread notation. See #11266 for an example. We probably don't need to polyfill Object.assign either.
mourner commentedon Oct 15, 2026
This was already done a while ago.