我尝试创建一个基类,它有一个静态实用程序方法来构造这个类,这个类使用return new this()。但是,当我有一个子类对它进行扩展时,它不能工作,因为该实用程序方法返回基类而不是子类,这与JavaScript不一样。最起码的例子: static create() { }class Sub extends Base {fn() {
我正在尝试引用我的子类中定义的静态属性,从父类中的非静态方法中引用,但无法找到实现此目的的方法。这在任何情况下都是可能的吗?console.log(this.constructor.staticList[key]); /** while this logs out the correct information, why is typescriptcorrectly logs out 2,