【发布时间】:2020-09-24 17:29:03
【问题描述】:
我提供了函数functionCaller 的示例。它需要一个函数,任何类型的函数。
const functionCaller = (func: any /* how to define this general func? */) => {
func();
};
functionCaller((hello: string) => {});
functionCaller(() => {});
functionCaller(() => new Promise((resolve) => {}));
如何在不使用any 的情况下定义这样的函数参数?
【问题讨论】:
标签: typescript