wing
wing copied to clipboard
`json` can be mutated
I tried this:
let a: MutJson = {a: 1, b: 0};
let b = MutJson {a: 1, b: 0};
let c = {a: 1, b: 0};
let d: Json = {a: 1, b: 0};
let e = Json {a: 1, b: 0};
let testMutJson = (x: MutJson) => {
x.delete("a");
log(x); // logs { b: 0 } each time :/
};
testMutJson(a);
log(a);
testMutJson(b);
log(b);
testMutJson(c);
log(c);
testMutJson(d);
log(d);
testMutJson(e);
log(e);
This happened:
I expected this:
to throw an error for the immutable jsons
Is there a workaround?
No response
Anything else?
No response
Wing Version
0.82.1
Node.js Version
No response
Platform(s)
MacOS
Community Notes
- Please vote by adding a 👍 reaction to the issue to help us prioritize.
- If you are interested to work on this issue, please leave a comment.