I get data from a server in the following format and I would like to define its type. I am struggling to define one of the keys as it depends on value of another key. Is it possible to define this type correctly or come a bit closer than just any
?
Pseudo-code below
type Data = {
result: string;
url: string;
[key: result]: { // <- ERROR. The key should be the value of the result key above.
message: string;
};
};