Is there a way to specify a partial type in TypeScript that also makes all child objects partials as well? For example:
interface Foobar {
foo: number;
bar: {
baz: boolean;
qux: string;
};
}
const foobar: Partial<Foobar> = {
foo: 1,
bar: { baz: true }
};
This throws the following error:
TS2741: Property 'qux' is missing in type '{ baz: true; }' but required in type '{ baz: boolean; qux: string; }'.
Is there any way to make child nodes partials as well?