davidmarkclements / rfdc

Really Fast Deep Clone
MIT License
635 stars 24 forks source link

Typescript: Clone maintains `readonly` property status #30

Open MarcelWaldvogel opened 2 years ago

MarcelWaldvogel commented 2 years ago

An object (or object tree) to be cloned may have some properties marked as readonly to prevent accidental modification in a (shared) object.

In the clone, the properties should be modifiable in this use case. I also believe this is the main use case for readonly, so changing the return type should not introduce new problems.

(Alternatively, two different signatures could be provided; but I think this will needlessly complicate things.)

trevor-vaughan commented 1 year ago

I just hit this as well. Is there a potential of the fix getting merged?