<br><br>On Monday, March 25, 2019, ViliusCreator <<a href="mailto:viliuskubilius416@gmail.com">viliuskubilius416@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="EN-AU" link="blue" vlink="#954F72"><p style="margin-right:0cm;margin-bottom:16.8pt;margin-left:0cm;background:white"><span style="color:rgb(51,51,51);font-family:Georgia,serif;font-size:12pt">```js</span></p><p style="margin-right:0cm;margin-bottom:16.8pt;margin-left:0cm;background:white"><span style="font-size:12.0pt;font-family:"Georgia",serif;color:#333333">let a = 10<u></u><u></u></span></p><p style="margin-right:0cm;margin-bottom:16.8pt;margin-left:0cm;background:white"><span style="font-size:12.0pt;font-family:"Georgia",serif;color:#333333">a += ‘1’ // ‘101’<u></u><u></u></span></p><p style="margin-right:0cm;margin-bottom:16.8pt;margin-left:0cm;background:white"><span style="font-size:12.0pt;font-family:"Georgia",serif;color:#333333">// or<u></u><u></u></span></p><p style="margin-right:0cm;margin-bottom:16.8pt;margin-left:0cm;background:white"><span style="font-size:12.0pt;font-family:"Georgia",serif;color:#333333">a += undefined // NaN<u></u><u></u></span></p><p style="margin-right:0cm;margin-bottom:16.8pt;margin-left:0cm;background:white"><span style="font-size:12.0pt;font-family:"Georgia",serif;color:#333333">```<u></u><u></u></span></p><p style="margin-right:0cm;margin-bottom:16.8pt;margin-left:0cm;background:white"><span style="font-size:12.0pt;font-family:"Georgia",serif;color:#333333">VS this:<u></u><u></u></span></p><p style="margin-right:0cm;margin-bottom:16.8pt;margin-left:0cm;background:white"><span style="font-size:12.0pt;font-family:"Georgia",serif;color:#333333">```js<u></u><u></u></span></p><p style="margin-right:0cm;margin-bottom:16.8pt;margin-left:0cm;background:white"><span style="font-size:12.0pt;font-family:"Georgia",serif;color:#333333">let a: number = 10<u></u><u></u></span></p><p style="margin-right:0cm;margin-bottom:16.8pt;margin-left:0cm;background:white"><span style="font-size:12.0pt;font-family:"Georgia",serif;color:#333333">a += ‘1’ // Error, cannot convert type string to type number.<u></u><u></u></span></p><p style="margin-right:0cm;margin-bottom:16.8pt;margin-left:0cm;background:white"><span style="font-size:12.0pt;font-family:"Georgia",serif;color:#333333">// or<u></u><u></u></span></p><p style="margin-right:0cm;margin-bottom:16.8pt;margin-left:0cm;background:white"><span style="font-size:12.0pt;font-family:"Georgia",serif;color:#333333">a += undefined // Error, number doesn’t have nullable mark.<u></u><u></u></span></p><p style="margin-right:0cm;margin-bottom:16.8pt;margin-left:0cm;background:white"><span style="font-size:12.0pt;font-family:"Georgia",serif;color:#333333">```</span></p></div></blockquote><div>Thought experiment:</div><div><br></div><div>```js</div><div><br></div><div>let a = 10;</div><div>let b: number = 10;</div><div>a === b; // true</div><div><br></div><div>```</div><div><br></div><div>Would an error at runtime or compiletime occur here?</div><div><br></div><div>```js</div><div><br></div><div>a += '1'; // ok</div><div>b += '1'; // error</div><div><br></div><div>```</div><div><br></div><div>If it is a runtime error, is it optimal for the engine to keep track of typed variables vs regular for the same value?</div><div><br></div><div>If not and it is a compiletime error, what happens here?</div><div><br></div><div><div>```js</div><div><br></div><div>var x = something();</div><div><br></div><div>a += x;</div><div>b += x; // error?</div><div><br></div><div>```</div></div>