I want to create an interface with a defined key, and also a variable key, like so :
interface Data {
api?: {
isReady: boolean;
};
[key: string]: string;
}
Which leads to an error : Property 'api' of type '{ isReady: boolean; }' is not assignable to string index type 'string'.
I understand that [key:string]: string says "every key of this interface should have a string as its value", which is not the case for api, so the error makes sense.
So, is this possible to create such an interface, with a clearly define key/value pair + a variable key at the same level?
Thanks
