e.g., `let i = 0; i++;`
They seem to be only worried about modifying objects, not reassignment of variables.
It may be beside the point. In my experience, the best developers in corporate environments care about things like this but for the masses it’s mutable code and global state all the way down. Delivering features quickly with poor practices is often easier to reward than late but robust projects.
jbreckmckye•47m ago
I think you want to use a TypeScript compiler extension.
This is a bit difficult as it's not very well documented, and, the API might change with the Go rewrite.
But, you can basically invent a middleware to the compilation process.
It could quietly transform all object like types into having read-only semantics. This would then make any mutation error out, with a message like you were attempting to violate field properties.
You would need to decide what to do about Proxies though. Maybe you just tolerate that as an escape hatch (like eval or calling plain JS)
Could be a fun project!