<h1 dir="auto"><code class="notranslate">never</code> and <code class="notranslate">void</code> assignability</h1>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="class Base {
    method() {
        throw new Error(&quot;Not Implemented&quot;);
    }
}

class Derived extends Base {
    method() {
        throw new Error(&quot;Not Implemented&quot;);
    }
}"><pre class="notranslate"><span class="pl-k">class</span> <span class="pl-smi">Base</span> <span class="pl-kos">{</span>
    <span class="pl-en">method</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
        <span class="pl-k">throw</span> <span class="pl-k">new</span> <span class="pl-smi">Error</span><span class="pl-kos">(</span><span class="pl-s">"Not Implemented"</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">Derived</span> <span class="pl-k">extends</span> <span class="pl-smi">Base</span> <span class="pl-kos">{</span>
    <span class="pl-en">method</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
        <span class="pl-k">throw</span> <span class="pl-k">new</span> <span class="pl-smi">Error</span><span class="pl-kos">(</span><span class="pl-s">"Not Implemented"</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
    <span class="pl-kos">}</span>
<span class="pl-kos">}</span></pre></div>
<h1 dir="auto">Allowing duplicate identifiers across declarations (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="155625968" data-permission-text="Title is private" data-url="https://github.com/microsoft/TypeScript/issues/8675" data-hovercard-type="issue" data-hovercard-url="/microsoft/TypeScript/issues/8675/hovercard" href="https://github.com/microsoft/TypeScript/issues/8675">#8675</a>, <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="155806845" data-permission-text="Title is private" data-url="https://github.com/microsoft/TypeScript/issues/8696" data-hovercard-type="pull_request" data-hovercard-url="/microsoft/TypeScript/pull/8696/hovercard" href="https://github.com/microsoft/TypeScript/pull/8696">#8696</a>)</h1>
<ul dir="auto">
<li>Introduced <code class="notranslate">stack</code> into the <code class="notranslate">Error</code> interface.</li>
<li>We report duplicate identifier errors, even if the types are the same.</li>
<li>These augmentations are the same.</li>
<li><g-emoji class="g-emoji" alias="+1" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/1f44d.png">👍</g-emoji>, let's allow this.</li>
<li>Need to do checks for same modifiers (<code class="notranslate">abstract</code>, <code class="notranslate">readonly</code>, visibility).</li>
</ul>
<h1 dir="auto"><code class="notranslate">super</code> issues</h1>
<h2 dir="auto">Subclassing without calling super (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="137111426" data-permission-text="Title is private" data-url="https://github.com/microsoft/TypeScript/issues/7285" data-hovercard-type="issue" data-hovercard-url="/microsoft/TypeScript/issues/7285/hovercard" href="https://github.com/microsoft/TypeScript/issues/7285">#7285</a>)</h2>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="class MyElement extends HTMLElement {
    constructor() {
        return document.createElement('my-element');
    }
}"><pre class="notranslate"><span class="pl-k">class</span> <span class="pl-smi">MyElement</span> <span class="pl-k">extends</span> <span class="pl-smi">HTMLElement</span> <span class="pl-kos">{</span>
    <span class="pl-en">constructor</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
        <span class="pl-k">return</span> <span class="pl-smi">document</span><span class="pl-kos">.</span><span class="pl-en">createElement</span><span class="pl-kos">(</span><span class="pl-s">'my-element'</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
    <span class="pl-kos">}</span>
<span class="pl-kos">}</span></pre></div>
<ul dir="auto">
<li>What is the behavior of the example?</li>
<li>Returns something that is an <code class="notranslate">instanceof</code> an <code class="notranslate">HTMLElement</code>...but not <code class="notranslate">MyElement</code>?</li>
<li>This is extremely odd. You aren't returning the instance you're constructing.</li>
<li><code class="notranslate">MyElement</code> won't be in your prototype chain, you won't get the appropriate methods.</li>
<li>But this is an ES2015 issue.</li>
<li>Unclear what we do about this.</li>
</ul>
<h2 dir="auto">Using return value of super calls (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="141764917" data-permission-text="Title is private" data-url="https://github.com/microsoft/TypeScript/issues/7574" data-hovercard-type="issue" data-hovercard-url="/microsoft/TypeScript/issues/7574/hovercard" href="https://github.com/microsoft/TypeScript/issues/7574">#7574</a>)</h2>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="class Foo {
    x: number;

    constructor() {
        return {
            x: 1,
        };
    }
}

class Bar extends Foo {
    y: number;

    constructor() {
        super();
        this.y = 2;
    }
}

let o = new Bar();
console.assert(o.x === 1 &amp;&amp; o.y === 2);"><pre class="notranslate"><span class="pl-k">class</span> <span class="pl-smi">Foo</span> <span class="pl-kos">{</span>
    <span class="pl-c1">x</span>: <span class="pl-smi">number</span><span class="pl-kos">;</span>

    <span class="pl-en">constructor</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
        <span class="pl-k">return</span> <span class="pl-kos">{</span>
            <span class="pl-c1">x</span>: <span class="pl-c1">1</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>

<span class="pl-k">class</span> <span class="pl-smi">Bar</span> <span class="pl-k">extends</span> <span class="pl-smi">Foo</span> <span class="pl-kos">{</span>
    <span class="pl-c1">y</span>: <span class="pl-smi">number</span><span class="pl-kos">;</span>

    <span class="pl-en">constructor</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
        <span class="pl-smi">super</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
        <span class="pl-smi">this</span><span class="pl-kos">.</span><span class="pl-c1">y</span> <span class="pl-c1">=</span> <span class="pl-c1">2</span><span class="pl-kos">;</span>
    <span class="pl-kos">}</span>
<span class="pl-kos">}</span>

<span class="pl-k">let</span> <span class="pl-s1">o</span> <span class="pl-c1">=</span> <span class="pl-k">new</span> <span class="pl-smi">Bar</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-en">assert</span><span class="pl-kos">(</span><span class="pl-s1">o</span><span class="pl-kos">.</span><span class="pl-c1">x</span> <span class="pl-c1">===</span> <span class="pl-c1">1</span> <span class="pl-c1">&amp;&amp;</span> <span class="pl-s1">o</span><span class="pl-kos">.</span><span class="pl-c1">y</span> <span class="pl-c1">===</span> <span class="pl-c1">2</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>
<p dir="auto">The actual behavior of this is that the assertion should not fail.<br>
In reality, <code class="notranslate">this</code> takes on the value of <code class="notranslate">{ x: 1 }</code> in <code class="notranslate">Bar</code>'s constructor, since <code class="notranslate">Foo</code> returned it from its constructor.</p>
<ul dir="auto">
<li>Incurs an overhead.
<ul dir="auto">
<li>This requires some wonky code to enable this scenario.</li>
<li>Everyone has to pay the price regardless of whether they use it.</li>
<li>Could we just do something like <code class="notranslate">_this = _super.call(this) || this</code> instead of a helper?
<ul dir="auto">
<li>Seems like spec says behavior for primitives causes issues.
<ul dir="auto">
<li>This is a very niche case.</li>
</ul>
</li>
</ul>
</li>
<li>We'd also have to return <code class="notranslate">_this</code> to maintain <code class="notranslate">_this</code> value.</li>
</ul>
</li>
<li>"If we had attributes, people could hint the correct thing."</li>
</ul>
<p dir="auto">We need to think about this more.<br>
This seems to be a large change for a somewhat niche scenario, but we should better understand the users of it.</p>
<h2 dir="auto">Super as the first statement (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="150708359" data-permission-text="Title is private" data-url="https://github.com/microsoft/TypeScript/issues/8277" data-hovercard-type="issue" data-hovercard-url="/microsoft/TypeScript/issues/8277/hovercard" href="https://github.com/microsoft/TypeScript/issues/8277">#8277</a>)</h2>
<ul dir="auto">
<li>Perhaps we could fake this with definite assignment analysis?</li>
<li>Start with a "poison" type, <code class="notranslate">super(/*...*/</code>) gives you some sort of "antidote" type (any other type?), check if you still end up with the poisoned type.</li>
<li>People an always cheat by putting code in an arrow function.
<ul dir="auto">
<li>Not a big deal, you're really trying at that point.</li>
</ul>
</li>
</ul>
<h1 dir="auto"><code class="notranslate">--target ES5 --module ES6</code></h1>
<ul dir="auto">
<li>Emit in ES5, entirely except for module</li>
<li>Useful for Rollup.
<ul dir="auto">
<li>Becoming an increasingly common tool.</li>
</ul>
</li>
<li>Why do we have to provide this functionality? How does Babel do this?
<ul dir="auto">
<li>There's a Babel plugin.</li>
<li>Well there's a TypeScript plugin too, but there are some issues with that.</li>
</ul>
</li>
<li>Let's just try it out and see how it works out.</li>
</ul>
<h1 dir="auto">Switch to not type-check <code class="notranslate">.d.ts</code> files</h1>
<ul dir="auto">
<li>Parse/bind <code class="notranslate">.d.ts</code> files.</li>
<li>Don't check them unless entities are referenced from those <code class="notranslate">.d.ts</code> files.</li>
<li>This means you might miss errors across files.</li>
<li>But would be much faster.</li>
<li>Angular and NativeScript both have said they'd like it.</li>
<li>Have to think of a name for this.</li>
</ul>
<p dir="auto">Hi there!</p>
<p dir="auto">I am writing a lot of code in an environment where JavaScript and TypeScript freely interact with each other. One thing that we continue to run into is where we would write a function in TypeScript, say:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="export function add(x: number, y: number): number {
  return x + y;
}"><pre class="notranslate"><code class="notranslate">export function add(x: number, y: number): number {
  return x + y;
}
</code></pre></div>
<p dir="auto">This function is callable from JavaScript, where we're allowed to do things like:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="add('abc', undefined)"><pre class="notranslate"><code class="notranslate">add('abc', undefined)
</code></pre></div>
<p dir="auto">This has lead us to introduce type checks for all exported functions in TypeScript, although they really feel verbose in a typed language.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="export function add(x: number, y: number): number {
  if (typeof x !== 'number' || typeof y !== 'number') {
    throw new TypeError('x and y need to be numbers');
  }
  return x + y;
}"><pre class="notranslate"><code class="notranslate">export function add(x: number, y: number): number {
  if (typeof x !== 'number' || typeof y !== 'number') {
    throw new TypeError('x and y need to be numbers');
  }
  return x + y;
}
</code></pre></div>
<p dir="auto">My idea is to provide an optional flag, say <code class="notranslate">--insertRuntimeTypeChecks</code>, that makes the compiler insert these kinds of checks for function arguments.</p>
<p dir="auto">The feature will probably be a bit more complicated when thinking about structural types, etc., especially in interplay with classes (it is my understanding that classes are type-checked structurally, not nominally, is that correct?).</p>
<p dir="auto">But even having it only for primitive types (checking for <code class="notranslate">object</code>, <code class="notranslate">string</code>, <code class="notranslate">number</code>, etc.) could provide a lot of benefits for those of us who write code that interacts with JavaScript, especially should <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="134699594" data-permission-text="Title is private" data-url="https://github.com/microsoft/TypeScript/issues/7140" data-hovercard-type="pull_request" data-hovercard-url="/microsoft/TypeScript/pull/7140/hovercard" href="https://github.com/microsoft/TypeScript/pull/7140">#7140</a> land, to spare us from manually writing <code class="notranslate">if (x === null) ...</code>.</p>
<p dir="auto">I'd be interested in giving implementing this a shot, if there's interest from the maintainers.</p>