title: Generic return type for index signature in TypeScript
body: <p>Here's the problem</p>
  
  <pre><code>interface Prop&lt;T&gt; {
     value: T;
  }
  
  class Property&lt;T&gt; implements Prop&lt;T&gt; {
     value: T;
     constructor(value: T) {
        this.value = value;
     }
  }
  
  class Node {
     this.props: { [index: string]: Prop&lt;T&gt; } // how do you define T?
  }
  </code></pre>
  
  <p><code>T</code> can't be defined at class level here as needs as the intended use would be along the lines of</p>
  
  <pre><code>const strProp = node.props&lt;string&gt;['strProp'];
  const numProp = node.props&lt;number&gt;['numProp'];
  </code></pre>
  
  <p>In other words, a <code>Node</code> can have various property types attached to it.</p>
  
  <p>There doesn't appear to be anything in the <a href="https://www.typescriptlang.org/docs/handbook/generics.html" rel="nofollow noreferrer">docs</a> about this (or perhaps I'm just not seeing it). Basically what I'm really looking for here is a generic indexer, for example:</p>
  
  <pre><code>this.props: &lt;T&gt;{ [index: string]: Prop&lt;T&gt; }
  </code></pre>
  
  <p>Does it exist?</p>
  
  <p><em>Disclaimer - I'm not looking for workarounds, I understand there are ways around this but I'd like to know whether or not the support is there (I couldn't see any proposals or outstanding issues on the repo for this). There were some similar issues but nothing specific to this particular scenario.</em></p>