is it possible to type an interface property dependent on another?
For example I have:
const object = {
foo: 'hello',
bar: { hello: '123', },
}
And I want to make sure that the key of bar must be the value of foo.
interface ObjectType = {
foo: string;
bar: { hello: string; } // instead of hardcoding have something like this? --> payload: { ValueOfFoo: string; }
}
Thanks! :)