I have a specific interface set up as shown below:
interface Actions {
run: any;
execute: any;
}
const actions: Actions = {
run: require("./runAction"),
execute: require("./executeAction"),
}
My goal is to call the functions associated with run and execute using the code snippet below:
const result = await actions[action_type]();
Here, action_type represents a string containing the name of the action (run/execute). However, I am encountering the following error message:
TS7053: Element implicitly has an 'any' type because expression of type 'any' can't be used to index type 'Actions'
Any suggestions on how to resolve this issue?