Open RebeccaStevens opened 1 year ago
I think we need both types.
ReadonlyDeep: The data is deeply immutable but methods are not.
Disagree. Readonly means readonly, even for methods.
There is "Readonly" built-in type in TS, so name ReadonlyDeep is quite intuitive when you need "Readonly" but not shallow.
The
ReadonlyDeep
type does more than just make types readonly, it fully makes them immutable.There's been a bit of discussion over at typescript-eslint about "Readonly" vs "Immutable". This is in regard to eslint rules such as
prefer-readonly-parameter-types
. I've made a library that can calculate type immutability (is-immutable-type) in a way consistent with this and this library will be used in the next release of eslint-plugin-functional. It would be nice if this utility type was also consistent with these definitions.Other issues of note: #396
Upvote & Fund