相关疑难解决方法(0)

TypeScript:获取类的实例方法的类型

我正在尝试获取类的实例方法的类型。除了在类的原型中查找类型之外,还有其他内置(更好)的方法吗?

class MyClass
{
    private delegate: typeof MyClass.prototype.myMethod; // gets the type ( boolean ) => number;

    public myMethod( arg: boolean )
    {
        return 3.14;
    }
}
Run Code Online (Sandbox Code Playgroud)

提前致谢!

typescript

13
推荐指数
4
解决办法
3857
查看次数

标签 统计

typescript ×1