How can I define keys: a, b, c, bar as undefined/null/optional type if foo is false? In other words, I need these properties to be mandatory only if foo is true.
interface ObjectType {
foo: boolean;
a: number;
y: string;
c: boolean;
bar?: { x: number; y: string; z: boolean };
}
Thanks! :)