oop - Typescript Abstract Class Method Access Derived Class Property -


abstract class myclass() {     protected static foo: array<number>;      protected static doworkonfoo(): void {         let x: number = 0;          (let f of | goes here? this? self?|.foo) {             x = x + foo;         }     } } 

when implementing abstract class, , wanting derived classes have static property , static method operates on properties, how 1 access in abstract class derived class can use method?

i know can worked around setting default value on static property , using this, sparked interested , i'm curious know if there's way access generic derived class or abstract class in ts.

thanks in advance!

edit:

while wasn't able find looking (see comments), workable solution change signature of doworkonfoo() method following:

protected static doworkonfoo(): (typeof myclass) => void; 

since abstract class can take derived class argument , reference derived class's static properties.


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -