Write MyReadonly<T>, and its opposite, Mutable<T>, which removes readonly.
MyReadonly<T> works like the built-in Readonly<T>. TypeScript has no built-in Mutable<T>: it should remove readonly from every property, and turn a readonly array or tuple into a mutable one.
type MyReadonly<T> = T; // every property readonlytype Mutable<T> = T; // no property readonly // MyReadonly<{ name: string }> // { readonly name: string }// Mutable<{ readonly name: string }> // { name: string }// Mutable<readonly string[]> // string[]The answer
Write it yourself first. Then compare it with a reference solution and the checks it passes.
Checking your sign-in…