type-fest icon indicating copy to clipboard operation
type-fest copied to clipboard

Rename `ReadonlyDeep` to `Immutable`

Open RebeccaStevens opened this issue 3 years ago • 2 comments

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

  • We're using Polar.sh so you can upvote and help fund this issue.
  • The funding will be given to active contributors.
  • Thank you in advance for helping prioritize & fund our backlog.
Fund with Polar

RebeccaStevens avatar Sep 30 '22 00:09 RebeccaStevens

I think we need both types.

skarab42 avatar Sep 30 '22 05:09 skarab42

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.

e-oz avatar Oct 24 '22 10:10 e-oz