<blockquote>
<p dir="auto">This issue was previously <a href="https://typescript.codeplex.com/workitem/2425" rel="nofollow">reported</a> as bug at codeplex, now trying to submit as suggestion.</p>
</blockquote>
<p dir="auto">Below, the <code class="notranslate">Collection.model</code> field is supposed to accept <strong>type of <code class="notranslate">TModel</code></strong> rather than <strong>instance of <code class="notranslate">TModel</code></strong>:</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="class Model { }
class Collection&lt;TModel extends Model&gt; {
    model: typeof TModel; //Error: Could not find symbold 'TModel'.
    models: TModel[];
}

class MyModel extends Model { }
class MyCollection extends Collection&lt;MyModel&gt; {
    // This is what we want
    model: typeof MyModel = MyModel;

    // This is what we don't want
    //model: MyModel = new MyModel;
}

var coll = new MyCollection();
var modelType = coll.model;
var newModel = new modelType();
"><pre class="notranslate"><span class="pl-k">class</span> <span class="pl-smi">Model</span> <span class="pl-kos">{</span> <span class="pl-kos">}</span>
<span class="pl-k">class</span> <span class="pl-smi">Collection</span><span class="pl-c1">&lt;</span><span class="pl-smi">TModel</span> <span class="pl-k">extends</span> <span class="pl-smi">Model</span><span class="pl-c1">&gt;</span> <span class="pl-kos">{</span>
    <span class="pl-c1">model</span>: <span class="pl-k">typeof</span> <span class="pl-smi">TModel</span><span class="pl-kos">;</span> <span class="pl-c">//Error: Could not find symbold 'TModel'.</span>
    <span class="pl-c1">models</span>: <span class="pl-smi">TModel</span><span class="pl-kos">[</span><span class="pl-kos">]</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span>

<span class="pl-k">class</span> <span class="pl-smi">MyModel</span> <span class="pl-k">extends</span> <span class="pl-smi">Model</span> <span class="pl-kos">{</span> <span class="pl-kos">}</span>
<span class="pl-k">class</span> <span class="pl-smi">MyCollection</span> <span class="pl-k">extends</span> <span class="pl-smi">Collection</span><span class="pl-kos">&lt;</span><span class="pl-smi">MyModel</span><span class="pl-kos">&gt;</span> <span class="pl-kos">{</span>
    <span class="pl-c">// This is what we want</span>
    <span class="pl-c1">model</span>: <span class="pl-k">typeof</span> <span class="pl-smi">MyModel</span> <span class="pl-c1">=</span> <span class="pl-smi">MyModel</span><span class="pl-kos">;</span>

    <span class="pl-c">// This is what we don't want</span>
    <span class="pl-c">//model: MyModel = new MyModel;</span>
<span class="pl-kos">}</span>

<span class="pl-k">var</span> <span class="pl-s1">coll</span> <span class="pl-c1">=</span> <span class="pl-k">new</span> <span class="pl-smi">MyCollection</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-k">var</span> <span class="pl-s1">modelType</span> <span class="pl-c1">=</span> <span class="pl-s1">coll</span><span class="pl-kos">.</span><span class="pl-c1">model</span><span class="pl-kos">;</span>
<span class="pl-k">var</span> <span class="pl-s1">newModel</span> <span class="pl-c1">=</span> <span class="pl-k">new</span> <span class="pl-s1">modelType</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>
<p dir="auto">Use of <code class="notranslate">typeof</code> keyword seems to be appropriate here, but compiler doesn't understand <code class="notranslate">typeof</code> of generic type. If we said <code class="notranslate">model: typeof Model;</code> it would compile but that is not exactly what we want.</p>
<p dir="auto">Some of the workarounds we found are the followings:</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="class Model { }
class Collection&lt;TModel extends Model&gt; {
        model: { new(): TModel; };
        models: TModel[];
}

class MyModel extends Model { }
class MyCollection extends Collection&lt;MyModel&gt; { }"><pre class="notranslate"><span class="pl-k">class</span> <span class="pl-smi">Model</span> <span class="pl-kos">{</span> <span class="pl-kos">}</span>
<span class="pl-k">class</span> <span class="pl-smi">Collection</span><span class="pl-c1">&lt;</span><span class="pl-smi">TModel</span> <span class="pl-k">extends</span> <span class="pl-smi">Model</span><span class="pl-c1">&gt;</span> <span class="pl-kos">{</span>
        <span class="pl-c1">model</span>: <span class="pl-kos">{</span> <span class="pl-k">new</span><span class="pl-kos">(</span><span class="pl-kos">)</span>: <span class="pl-smi">TModel</span><span class="pl-kos">;</span> <span class="pl-kos">}</span><span class="pl-kos">;</span>
        <span class="pl-c1">models</span>: <span class="pl-smi">TModel</span><span class="pl-kos">[</span><span class="pl-kos">]</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span>

<span class="pl-k">class</span> <span class="pl-smi">MyModel</span> <span class="pl-k">extends</span> <span class="pl-smi">Model</span> <span class="pl-kos">{</span> <span class="pl-kos">}</span>
<span class="pl-k">class</span> <span class="pl-smi">MyCollection</span> <span class="pl-k">extends</span> <span class="pl-smi">Collection</span><span class="pl-kos">&lt;</span><span class="pl-smi">MyModel</span><span class="pl-kos">&gt;</span> <span class="pl-kos">{</span> <span class="pl-kos">}</span></pre></div>
<p dir="auto">and</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="class Model { }
class Collection&lt;TModelConstructor extends typeof Model, TModel extends Model&gt; {
        model: TModelConstructor;
        models: TModel[];
}

class MyModel extends Model { }
class MyCollection extends Collection&lt;typeof MyModel, MyModel&gt; { }"><pre class="notranslate"><span class="pl-k">class</span> <span class="pl-smi">Model</span> <span class="pl-kos">{</span> <span class="pl-kos">}</span>
<span class="pl-k">class</span> <span class="pl-smi">Collection</span><span class="pl-c1">&lt;</span><span class="pl-smi">TModelConstructor</span> <span class="pl-k">extends</span> <span class="pl-k">typeof</span> <span class="pl-smi">Model</span><span class="pl-kos">,</span> <span class="pl-smi">TModel</span> <span class="pl-k">extends</span> <span class="pl-smi">Model</span><span class="pl-c1">&gt;</span> <span class="pl-kos">{</span>
        <span class="pl-c1">model</span>: <span class="pl-smi">TModelConstructor</span><span class="pl-kos">;</span>
        <span class="pl-c1">models</span>: <span class="pl-smi">TModel</span><span class="pl-kos">[</span><span class="pl-kos">]</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span>

<span class="pl-k">class</span> <span class="pl-smi">MyModel</span> <span class="pl-k">extends</span> <span class="pl-smi">Model</span> <span class="pl-kos">{</span> <span class="pl-kos">}</span>
<span class="pl-k">class</span> <span class="pl-smi">MyCollection</span> <span class="pl-k">extends</span> <span class="pl-smi">Collection</span><span class="pl-kos">&lt;</span><span class="pl-k">typeof</span> <span class="pl-smi">MyModel</span><span class="pl-kos">,</span> <span class="pl-smi">MyModel</span><span class="pl-kos">&gt;</span> <span class="pl-kos">{</span> <span class="pl-kos">}</span></pre></div>
<p dir="auto">Feature suggestion is to allow <code class="notranslate">typeof</code> generic type.</p>
<p dir="auto">This issue tracks our plans and discussion around the current situation with package typings.</p>
<p dir="auto">Internally, we've been talking about how to better package, locate, and discover typings for packages which do not include their own typings.</p>
<p dir="auto">The issues which arise around packages and their typings include:</p>
<ul dir="auto">
<li>Reuse - the ability to take typings written for long-ago TS (ambient declarations) and continue to use them with little or no modification</li>
<li>Dependency management - typings typically depend on the same things that their host js packages do - and usually on their typings, not their js.</li>
<li>De-duplication and flattening - Deeply nested typings (with potentially duplicated dependencies at multiple levels) lead to a lot of duplicated work in the compiler, and could result in longer build times. We'd like to head this off before it becomes an issue in practice if possible.</li>
<li>Discovery - if I'm using package the node package <code class="notranslate">bluebird</code>, how can I find types for it without skipping a beat?</li>
</ul>
<p dir="auto">We've spoken with <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/blakeembrey/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/blakeembrey">@blakeembrey</a> and his plans for <a href="https://github.com/typings"><code class="notranslate">typings</code></a> (a tool to replace/improve upon <a href="https://github.com/DefinitelyTyped/tsd"><code class="notranslate">tsd</code></a>). We believe that we're both setting out to solve a lot of the same problems, and we'd love to help build much of that functionality into the compiler and language service to create a seamless development experience.</p>
<p dir="auto">We've come up with a number of improvements to pursue on our end, including:</p>
<ul dir="auto">
<li>Package scopes (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="107619192" data-permission-text="Title is private" data-url="https://github.com/microsoft/TypeScript/issues/4913" data-hovercard-type="pull_request" data-hovercard-url="/microsoft/TypeScript/pull/4913/hovercard" href="https://github.com/microsoft/TypeScript/pull/4913">#4913</a>) to help with typing reuse and isolation issues</li>
<li>Extending our node module resolution for typings to have a concept of a fallback-typings package - a package which provides typings for a correspondingly named package. (For example, <code class="notranslate">typed-debug</code> can be installed and provides types for the <code class="notranslate">debug</code> module.)</li>
<li>Reducing the volume of type checking done for packages (ie, don't typecheck them)</li>
</ul>
<p dir="auto">We want to make it <em>seamless</em> for users to use typescript with their existing tools and processes, and this includes their dealings with typings. Ideally, we want users to be able to <code class="notranslate">npm install</code> their dependencies as they already do and have everything "just work" without further steps or instructions.</p>
<p dir="auto">Tagging <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/mhegazy/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/mhegazy">@mhegazy</a> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/ahejlsberg/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/ahejlsberg">@ahejlsberg</a> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/vladima/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/vladima">@vladima</a> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/DanielRosenwasser/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/DanielRosenwasser">@DanielRosenwasser</a> and probably many others who should get tagged for discussion.</p>
<p dir="auto">I'm sure I've forgetting things from our discussion earlier, so feel free to chime in with the relevant conversion points I've missed.</p>