I have a function that returns something like:
function someFunction() {
return {
[id]: {
desc1: desc1,
desc2: desc2,
},
};
}
where I have an interface defined as:
export interface SomeInterface {
desc1: desc1;
desc2: desc2;
}
Then I have some code that calls this:
let output: { [key: string[]]: SomeInterface }; // Tried to type it this way but gave an error
output = someFunction() // I have multiple calls to this in the code
However, I get a typescript error on key:
An index signature parameter type must be 'string', 'number', 'symbol', or a template literal type.ts