cf.completefrontend

Write the codeHard

Write DeepPartial<T> for nested settings, keeping functions callable and arrays as arrays.

Partial only makes the top-level properties optional. DeepPartial<T> should make nested object properties optional too. A function must stay the same function type, and an array must stay an array (readonly or not, tuple or not) whose elements are deep partial, but never undefined.

Write this
type DeepPartial<T> = { [K in keyof T]?: T[K] }; // only one level deep // type Overrides = DeepPartial<{ theme: { color: string; dark: boolean } }>;// { theme?: { color?: string; dark?: boolean } }

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…