<p dir="auto">Sometimes it's useful to declare new types within a class/interface, especially when it's a generic:</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="class Tree&lt;T&gt; {
  private type Node = { data: T, subnodes: Node[] };
  public root: Node = { data: null, subnodes: [] };
  ...
}"><pre class="notranslate"><span class="pl-k">class</span> <span class="pl-smi">Tree</span><span class="pl-c1">&lt;</span><span class="pl-smi">T</span><span class="pl-c1">&gt;</span> <span class="pl-kos">{</span>
  <span class="pl-k">private</span> <span class="pl-c1">type</span> <span class="pl-c1">Node</span> <span class="pl-c1">=</span> <span class="pl-kos">{</span> <span class="pl-c1">data</span>: <span class="pl-smi">T</span><span class="pl-kos">,</span> <span class="pl-c1">subnodes</span>: <span class="pl-smi">Node</span><span class="pl-kos">[</span><span class="pl-s1"></span><span class="pl-kos">]</span> <span class="pl-kos">}</span><span class="pl-kos">;</span>
  <span class="pl-k">public</span> <span class="pl-c1">root</span>: <span class="pl-smi">Node</span> <span class="pl-c1">=</span> <span class="pl-kos">{</span> <span class="pl-c1">data</span>: <span class="pl-c1">null</span><span class="pl-kos">,</span> <span class="pl-c1">subnodes</span>: <span class="pl-kos">[</span><span class="pl-kos">]</span> <span class="pl-kos">}</span><span class="pl-kos">;</span>
  ...
<span class="pl-kos">}</span></pre></div>
<p dir="auto">Such member types could be referred to as <code class="notranslate">Tree&lt;T&gt;.Node</code>.</p>
<p dir="auto">I normally want my class declaration to be the first thing in my file:</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="module foo {

  /** My foo class */
  export class MyFoo {

  }
}"><pre class="notranslate">module <span class="pl-s1">foo</span> <span class="pl-kos">{</span>

  <span class="pl-c">/** My foo class */</span>
  <span class="pl-k">export</span> <span class="pl-k">class</span> <span class="pl-smi">MyFoo</span> <span class="pl-kos">{</span>

  <span class="pl-kos">}</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto">So when I want to declare an alias, I don't like the fact that my class has been pushed down further:</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="module foo {

 type foobar = foo.bar.baz.FooBar;

  /** My foo class */
  export class MyFoo {

  }
}"><pre class="notranslate">module <span class="pl-s1">foo</span> <span class="pl-kos">{</span>

 <span class="pl-k">type</span> <span class="pl-smi">foobar</span> <span class="pl-c1">=</span> <span class="pl-s1">foo</span><span class="pl-kos">.</span><span class="pl-s1">bar</span><span class="pl-kos">.</span><span class="pl-s1">baz</span><span class="pl-kos">.</span><span class="pl-smi">FooBar</span><span class="pl-kos">;</span>

  <span class="pl-c">/** My foo class */</span>
  <span class="pl-k">export</span> <span class="pl-k">class</span> <span class="pl-smi">MyFoo</span> <span class="pl-kos">{</span>

  <span class="pl-kos">}</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto">I suggest the following be permitted:</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="module foo {

  /** My foo class */
  export class MyFoo {
    type foobar = foo.bar.baz.FooBar;
  }
}"><pre class="notranslate">module <span class="pl-s1">foo</span> <span class="pl-kos">{</span>

  <span class="pl-c">/** My foo class */</span>
  <span class="pl-k">export</span> <span class="pl-k">class</span> <span class="pl-smi">MyFoo</span> <span class="pl-kos">{</span>
    <span class="pl-c1">type</span> <span class="pl-c1">foobar</span> <span class="pl-c1">=</span> <span class="pl-s1">foo</span><span class="pl-kos">.</span><span class="pl-c1">bar</span><span class="pl-kos">.</span><span class="pl-c1">baz</span><span class="pl-kos">.</span><span class="pl-c1">FooBar</span><span class="pl-kos">;</span>
  <span class="pl-kos">}</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto">Since <code class="notranslate">type foobar</code> is just a compile-time construct, and if people want to write it that way, then they should be permitted to do so. Note that the type <code class="notranslate">foobar</code> is private to the class. It should not be permissible to export <code class="notranslate">foobar</code>.</p>