|
|
|
|
|
by eyelidlessness
1736 days ago
|
|
I should add another way I tried to approach this that would be less Type System Theater was Symbols and runtime assignment of brands, eg const MySpecialPrimitiveBrand = Symbol('mySpecialPrimitive')
const val = Object.assign(prevVal, { [MySpecialPrimitiveBrand]: doesntMatter })
Yeah, don’t do that unless you want to destroy every language facility that depends on reference equality checks. It boxes your primitive and breaks the world. |
|