I have few functions defined like below and I tried defining the type as : {[key: string]: any }
and : {[key: string]: Function }
but due to the eslint rules, no-explicit-any and ban-types I couldn't use those type definitions.
The reason for the below structure is that I have a dynamic code that calls the below function based on the value ( ex: someDefinition(someVar), where someVar is based on a value passed)
const someDefinitions: {[key: string]: any } = {
A: (v: string): string => 'Returning A',
B: (v: string): string => 'Returning B with ' + v,
C: (v: string): string => 'Returning C',
};
Is there any way to define the types satisfying the rules?