-
Notifications
You must be signed in to change notification settings - Fork 475
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add structuredClone support #224
Comments
No, no plans, and that line is essential. Would I like to support structuredClone? Yes. |
OK, thanks. |
Just landed here as structured clone is finally becoming the goto for deep cloning an object. @WinterSmileSB101 what did you end up doing to get around this? For now here's my painful "fix" that conforms to typing. Here's a simple example without crazy nesting involved: const { decimalOne, decimalTwo, ...withoutDecimals } = originalObject // originalObject satisfies SomeType
const newObjectWithoutDecimals = structuredClone(withoutDecimals)
const newObject: SomeType = {
...newObjectWithoutDecimals,
decimalOne: new Decimal(decimalOne),
decimaltwo: new Decimal(decimalTwo),
} |
Decimal.js seems to not support structuredClone, this method will throw DataCloneError because of decimal instance contains a function(
constructor
) due to this line code:https://github.com/MikeMcl/decimal.js/blob/master/decimal.js#L4294
Any plans to support it?
The text was updated successfully, but these errors were encountered: