How to ensure that provided "inner interface" in interface ExampleActions
like for example testAction
one, have to strictly match Action
interface? No avocado
-like properties allowed.
interface Action {
resultType?: any;
data?: any;
}
type Actions = Record<string, Action>;
interface ExampleActions extends Actions {
testAction: {
resultType: number;
data: string;
avocado: boolean; //Here should be error? Action interface hasn't property avocado
}
//Here is error as expected:
//Property 'invalidAction' of type 'string' is not assignable to 'string' index type 'Action'.(2411)
invalidAction: string;
}