title: Typescript Abstract Class Method Access Derived Class Property
body: <pre><code>abstract class MyClass() {
      protected static foo: Array&lt;number&gt;;
  
      protected static doWorkOnFoo(): void {
          let x: number = 0;
  
          for (let f of | what goes here? this? self?|.foo) {
              x = x + foo;
          }
      }
  }
  </code></pre>
  
  <p>When implementing an abstract class, and wanting derived classes to have a static property and a static method that operates on those properties, how would one access those in the abstract class so that the derived class can just use that method?</p>
  
  <p>I know this can be worked around by just setting a default value on the static property and using <code>this</code>, but this sparked my interested and I'm curious to know if there's some way to access generic derived class or something from an abstract class in TS.</p>
  
  <p>Thanks in advance!</p>
  
  <p>EDIT:</p>
  
  <p>While I wasn't able to find exactly what I was looking for (see comments), a workable solution is to change the signature of the <code>doWorkOnFoo()</code> method to the following:</p>
  
  <pre><code>protected static doWorkOnFoo(): (typeof MyClass) =&gt; void;
  </code></pre>
  
  <p>Since it is already an abstract class it can take a derived class as an argument and then reference the derived class's static properties.</p>