Adopt object spread and polyfill Object.assign
Open
Nobody has claimed this yet.
refactoring :building_construction:
- Dominant language
- TypeScript
- Stars
- 12.4k
- Forks
- 2.4k
- PR merge metrics
- No merged PRs in 30d
Description
Currently we use a custom extend utility function because Object.assign isn't supported in IE11.
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
extendand all code that uses it in Flow is really hard, which I discovered while working on #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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the custom extend utility in src/util/util.js and review how it is used across the code base. Determine where Object.assign must be polyfilled for IE11, then migrate the relevant extensions to object spread. Done means the code no longer depends on extend for these cases and IE11 remains supported.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- frontend, web-dev
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100