I prefer to utilize Typescript for ensuring immutability in my code. Unfortunately, many libraries do not type their exported function parameters as Readonly or DeepReadonly, even if they are not meant to be mutated. This commonly causes issues because a ReadonlyArray is not compatible with an Array.
One way to address this issue is by redefining the function using module augmentation, which is explained in this Stack Overflow post: here. However, I am curious about how we can wrap an existing type definition so that we maintain the current definition but define all parameters as DeepReadonly.