function whatever(object, methodName, args) {
return object[methodName](...args);
}
Can the above be typed so the the following is enforced:
methodNameis a key ofobject.object[methodName]is callable and its args are...args.- The return type of
whatever(object, methodName, args)is the return type ofobject[methodName](...args).
The closest thing I could find is the definition of function.apply, but it isn't quite the same as the above.