Open a0s opened 3 months ago
Hi! Thanks for bringing up issues like this. I'll have to look into it, but my first thought is that it's a bit too general, and should not be needed since all the valid keys are already specified. I'm not a TypeScript expert though so I might be wrong. :sweat_smile: As soon as I get the time I will do some investigations.
So, expanding the type to accept anything does not really feel like the correct way to solve this. You will lose some valuable type checks then.
I think it's better to adjust the code that uses it instead. Maybe something like this:
Object.keys(props.metadata).forEach((header, headerIndex) => {
const tags = props.metadata[header as keyof ExpandedTags];
if (tags) {
...
}
})
This is something that i had to add to stop complaining from compiler on my code:
The error was:
I'm not sure, but perhaps the same thing should be added to every interface containing string keys.