Like Scheme's boxes but for TypeScript.
unboxboxmyObj === myObj
Why do you need this? You probably don't. If you've ever wanted JS to have pointers to pointers or out parameters, boxes can help.
npm i ts-boxed
Boxes are mutable references to a single value.
;// Unboxing gets the original value (reference equality)...;unboxboxmyObj === myObj;// without mutating the box.;unboxmyBox === 'contents';unboxmyBox === 'contents'; // still true// Like Scheme, the setter has scary punctuation (too bad `set-box!` isn't a valid JS identifier).setBox$myBox, '2';unboxmyBox === '2';setBox$myBox, '3';unboxmyBox === '3';
isBox is a runtime check but also provides type information