<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="function foo():number {
    var v2 = 5 + v1
    var v1 = 3
    return v2
}"><pre class="notranslate"><code class="notranslate">function foo():number {
    var v2 = 5 + v1
    var v1 = 3
    return v2
}
</code></pre></div>
<p dir="auto">When compiled, I expect this to output a warning because the variable v1 is used before it is declared. Instead it compiles without complaint, and emits a function that returns NaN.</p>
<p dir="auto">message TS6029: Version 1.6.2</p>
<p dir="auto">Introduce two new syntax for type declaration based on JSDoc</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="var myString: !string = 'hello world'; //non-nullable
var myString1: ?string = 'hello world'; // nullable 
var myString2: string = 'hello world'; // nullable 
var myString3 = 'hello world'; // nullable"><pre class="notranslate"><span class="pl-k">var</span> <span class="pl-s1">myString</span>: <span class="pl-c1">!</span><span class="pl-smi">string</span> <span class="pl-c1">=</span> <span class="pl-s">'hello world'</span><span class="pl-kos">;</span> <span class="pl-c">//non-nullable</span>
<span class="pl-k">var</span> <span class="pl-s1">myString1</span>: ?<span class="pl-smi">string</span> <span class="pl-c1">=</span> <span class="pl-s">'hello world'</span><span class="pl-kos">;</span> <span class="pl-c">// nullable </span>
<span class="pl-k">var</span> <span class="pl-s1">myString2</span>: <span class="pl-smi">string</span> <span class="pl-c1">=</span> <span class="pl-s">'hello world'</span><span class="pl-kos">;</span> <span class="pl-c">// nullable </span>
<span class="pl-k">var</span> <span class="pl-s1">myString3</span> <span class="pl-c1">=</span> <span class="pl-s">'hello world'</span><span class="pl-kos">;</span> <span class="pl-c">// nullable</span></pre></div>
<p dir="auto">by default type are nullable.</p>
<p dir="auto">Two new compiler flag :</p>
<ul dir="auto">
<li><code class="notranslate">inferNonNullableType</code> make the compiler infer non-nullable type  :</li>
</ul>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="var myString3 = 'hello world' // typeof myString is '!string', non-nullable"><pre class="notranslate"><span class="pl-k">var</span> <span class="pl-s1">myString3</span> <span class="pl-c1">=</span> <span class="pl-s">'hello world'</span> <span class="pl-c">// typeof myString is '!string', non-nullable</span></pre></div>
<ul dir="auto">
<li><code class="notranslate">nonNullableTypeByDefault</code> (I guess there might be a better name) :</li>
</ul>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="var myString: !string = 'hello world'; // non-nullable
var myString1: string = 'hello world'; // non-nullable 
var myString2: ?string = 'hello world'; // nullable 
var myString3 = 'hello world' // non-nullable"><pre class="notranslate"><span class="pl-k">var</span> <span class="pl-s1">myString</span>: <span class="pl-c1">!</span><span class="pl-smi">string</span> <span class="pl-c1">=</span> <span class="pl-s">'hello world'</span><span class="pl-kos">;</span> <span class="pl-c">// non-nullable</span>
<span class="pl-k">var</span> <span class="pl-s1">myString1</span>: <span class="pl-smi">string</span> <span class="pl-c1">=</span> <span class="pl-s">'hello world'</span><span class="pl-kos">;</span> <span class="pl-c">// non-nullable </span>
<span class="pl-k">var</span> <span class="pl-s1">myString2</span>: ?<span class="pl-smi">string</span> <span class="pl-c1">=</span> <span class="pl-s">'hello world'</span><span class="pl-kos">;</span> <span class="pl-c">// nullable </span>
<span class="pl-k">var</span> <span class="pl-s1">myString3</span> <span class="pl-c1">=</span> <span class="pl-s">'hello world'</span> <span class="pl-c">// non-nullable</span></pre></div>