There's a record & tuple proposal that would address this use case (currently served by tools such as Immer):
const foo = #{};
foo = 42; //not allowed
foo.bar = 'baz'; //not allowed
https://2ality.com/2020/05/records-tuples-first-look.html