Implement shim/polyfil for structuredClose()
#558
Labels
area/ecmascript
Relates to ecmascript module
area/vrotsc
Relates to `vrotsc` module
effort/low
kind/feature
New Feature to the project
lang/typescript
Related to typescript code
priority/low
triage/needed
Needs to be discussed by project maintainers
version/minor
Introduces a non-breaking feature or change
Description
It is a common task that we need to deep clone an object and change it's values without affecting the original. It might be useful to implement a shim/polyfil for
structuredClone()
so that we have that function out of the box. This would lead to more consistency and simplicity across the different approaches of implementing similar solution (most of which actually do not deep clone the object and lead to issues and bugs later down the line).Alternatives
Additional Context
https://developer.mozilla.org/en-US/docs/Web/API/Window/structuredClone
It can be something as simple as
Note that this has some restrictions, e.g. works mainly for simple objects
The text was updated successfully, but these errors were encountered: