Usage for (deep) readonly and object freeze
When I read the proposal, my first thought was: I want to abuse this to get rid of my typescript deep-readonly problems, where the type is not easy to get rid of those "readonly" flags when I clone it.
If this `Composite` object would be deeply immutable (readonly or frozen) and would have an "extract" function like `Composite.extract(Composite({ ...}))` which returns a deep clone which is mutable, that would be sooo nice!
Especially if it would play along with TypeScript, being of type `Composite<T>` and the `.extract` would become `T`.
1 条评论