cf.completefrontend

Write the codeHard

Write DeepReadonly<T>: make every nested property and array readonly, but keep functions callable.

Write this
type DeepReadonly<T> = Readonly<T>; // only the top level is readonly type Settings = {  theme: { color: string; sizes: number[] };  onSave: (value: string) => void;}; // const settings: DeepReadonly<Settings>// settings.theme.color = "red";  // should be an error// settings.theme.sizes.push(1);  // should be an error// settings.onSave("draft");      // should still work

Solve it in the editor

The answer

Write it yourself first. Then compare it with a reference solution and the checks it passes.

Checking your sign-in…