title: Typescript recursive types
body: <p>Just trying to get my head around creating typings for recursive data structures. Can anyone give any refinements on what should be done? i.e. currently linting complains if I set:</p>
  <pre><code>const graph: INestedGraph&lt;typeof data&gt; = data; 
  </code></pre>
  <p>Any help would be massively appreciated!</p>
  <pre><code>interface INestedGraph&lt;T&gt; {
      name: string;
      position?: number[];
      children?: T[] extends INestedGraph&lt;infer U&gt;[] ? INestedGraph&lt;U&gt;[]: null[]; 
  }
  </code></pre>
  <pre><code>const data =  {
      name: &quot;root&quot;,
      children: [
        {name: &quot;child #1&quot;},
        {name: &quot;child #2&quot;,
          children: [
            {name: &quot;grandchild #1&quot;,
              children: [{name: &quot;great-grandChild#1&quot;}]},
            {name: &quot;grandchild #2&quot;},
            {name: &quot;grandchild #3&quot;}
          ]
        }, 
        {name: 'child #3', 
          children: [
              {name: 'grandchild #6'}
          ]}
      ]
    }; 
  </code></pre>