Unfortunately, there are not many ways to strictly limit data mutation in TypeScript
type Foo = { bar: number; bas: number; } type FooReadonly = Readonly<Foo>;
or
const list = ["Apple", "Orange", "Banana", "Grape"] as const;
Mutation doesn't affect referential transparency - reference stays the same.
const test = {} test.a = 1 test === test
Yes, I missed that
I have updated the post
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
or
Mutation doesn't affect referential transparency - reference stays the same.
Yes, I missed that
I have updated the post