Although I'm sure this question has been asked before, I couldn't find the answer on Google or SO. So here it goes:
I am looking to create an interface with a key named id
of type number
. Additionally, there may be other keys with unknown names and string values.
This is what I have tried so far:
export interface MyInterface {
id: number
[key: string]: string
}
However, I am getting the following error message:
Property 'id' of type 'number' is not assignable to string index type 'string'.
Is there a way to make this work?