我正在寻找一种方法来获取传入参数的函数名称
console.clear();
class A{
test(){
}
testCall(fnc:Function){
console.log(fnc.name); // i want it display test here not empty
console.log(fnc);
}
}
var a=new A();
a.testCall(a.test);
你可以在 jsbin 中检查这个http://jsbin.com/loluhu/edit?js,控制台 http://jsbin.com/loluhu/edit?js,console
我发现这是打字稿中的一个错误
你可以在这里找到解决方案TypeScript 不提供函数名称 https://stackoverflow.com/questions/33647589/typescript-not-providing-function-name
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)