type DeepPartial = T extends object ? { [P in keyof T]?: DeepPartial; } : T; interface User { id: string; name: string; address: { street: string; city: string; zip: number; }; preferences?: { theme: 'dark' | 'light'; notifications: boolean; }; } type PartialUserUpdate = DeepPartial; const update1: PartialUserUpdate = { name: 'Jane Doe', address: { city: 'New York' } }; const update2: PartialUserUpdate = { preferences: { theme: 'dark' } }; // Example of DeepPartial with an array - optional, but good to cover type DeepPartialArray = T extends Array ? Array> : DeepPartial; interface Post { id: number; title: string; comments: { author: string; text: string }[]; } type PartialPostUpdate = DeepPartialArray; const postUpdate: PartialPostUpdate = { comments: [{ author: 'Alice' }] // Notice how it makes array elements DeepPartial, not just the array itself optional };