deepPartial type utility
📝 TypeScriptMakes all properties of an object type optional, recursively through nested objects, so you can easily work with partial updates or configurations.
TypeScript
type DeepPartial<T> = T extends Function ? T : T extends (infer U)[] ? DeepPartial<U>[] : T extends object ? { [P in keyof T]?: DeepPartial<T[P]> } : T;
Comments
YES, DeepPartial is a game-changer for handling nested configs or partial updates. Love how it keeps type safety while allowing flexibility.
@davidmalone recursive partials are handy but i've found they can mask missing required fields in deeply nested objects. ever run into that?