如何获取函数名称的类型(类型fnName = FunctionName <typeof fn =“”>)?

时间:2018-07-30 09:18:22

标签: typescript

我需要类似getFunctionName的东西:

type FunctionName<F extends (...args: any[]) => any> = getFunctionName F;

用例:

function foo() {
}

type FooName = FunctionName<typeof foo>; // should be resolved to "foo"

像这样可能吗?

0 个答案:

没有答案
相关问题