<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Georgia;
        panose-1:2 4 5 2 5 4 5 2 3 3;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
code
        {mso-style-priority:99;
        font-family:"Courier New";}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
/* List Definitions */
@list l0
        {mso-list-id:31007294;
        mso-list-type:hybrid;
        mso-list-template-ids:-1730899376 -1 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;}
@list l0:level1
        {mso-level-start-at:0;
        mso-level-number-format:bullet;
        mso-level-text:\F0D8;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:Wingdings;
        mso-fareast-font-family:"Times New Roman";
        mso-bidi-font-family:Calibri;}
@list l0:level2
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:"Courier New";}
@list l0:level3
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:Wingdings;}
@list l0:level4
        {mso-level-number-format:bullet;
        mso-level-text:\F0B7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:Symbol;}
@list l0:level5
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:"Courier New";}
@list l0:level6
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:Wingdings;}
@list l0:level7
        {mso-level-number-format:bullet;
        mso-level-text:\F0B7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:Symbol;}
@list l0:level8
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:"Courier New";}
@list l0:level9
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:Wingdings;}
@list l1
        {mso-list-id:617611828;
        mso-list-type:hybrid;
        mso-list-template-ids:1963863184 -1 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;}
@list l1:level1
        {mso-level-start-at:0;
        mso-level-number-format:bullet;
        mso-level-text:\F0D8;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:54.0pt;
        text-indent:-18.0pt;
        font-family:Wingdings;
        mso-fareast-font-family:"Times New Roman";
        mso-bidi-font-family:Calibri;}
@list l1:level2
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:90.0pt;
        text-indent:-18.0pt;
        font-family:"Courier New";}
@list l1:level3
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:126.0pt;
        text-indent:-18.0pt;
        font-family:Wingdings;}
@list l1:level4
        {mso-level-number-format:bullet;
        mso-level-text:\F0B7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:162.0pt;
        text-indent:-18.0pt;
        font-family:Symbol;}
@list l1:level5
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:198.0pt;
        text-indent:-18.0pt;
        font-family:"Courier New";}
@list l1:level6
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:234.0pt;
        text-indent:-18.0pt;
        font-family:Wingdings;}
@list l1:level7
        {mso-level-number-format:bullet;
        mso-level-text:\F0B7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:270.0pt;
        text-indent:-18.0pt;
        font-family:Symbol;}
@list l1:level8
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:306.0pt;
        text-indent:-18.0pt;
        font-family:"Courier New";}
@list l1:level9
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:342.0pt;
        text-indent:-18.0pt;
        font-family:Wingdings;}
@list l2
        {mso-list-id:1810857796;
        mso-list-type:hybrid;
        mso-list-template-ids:756028606 -1 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;}
@list l2:level1
        {mso-level-start-at:0;
        mso-level-number-format:bullet;
        mso-level-text:\F0D8;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        mso-ansi-font-size:11.0pt;
        font-family:Wingdings;
        mso-fareast-font-family:"Times New Roman";
        mso-bidi-font-family:Calibri;
        color:windowtext;}
@list l2:level2
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:"Courier New";}
@list l2:level3
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:Wingdings;}
@list l2:level4
        {mso-level-number-format:bullet;
        mso-level-text:\F0B7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:Symbol;}
@list l2:level5
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:"Courier New";}
@list l2:level6
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:Wingdings;}
@list l2:level7
        {mso-level-number-format:bullet;
        mso-level-text:\F0B7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:Symbol;}
@list l2:level8
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:"Courier New";}
@list l2:level9
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:Wingdings;}
ol
        {margin-bottom:0cm;}
ul
        {margin-bottom:0cm;}
--></style></head><body lang=EN-AU link=blue vlink="#954F72"><div class=WordSection1><p style='mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:16.8pt;margin-left:0cm;background:white'><span lang=EN-US>> </span><span style='font-size:12.0pt;font-family:"Georgia",serif;color:#333333'>Hello, to play the devils advocate: why does JavaScript need static typing? Your proposal doesn't really answer that. Sure, it mentions tooling and IDEs that can provide you with type hints and complain on mistakes<o:p></o:p></span></p><p style='mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:16.8pt;margin-left:0cm;background:white'><span style='font-size:12.0pt;font-family:"Georgia",serif;color:#333333'>I actually did. It keeps unwanted type mutations and bad values away. For example,<o:p></o:p></span></p><p style='mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:16.8pt;margin-left:0cm;background:white'><span style='font-size:12.0pt;font-family:"Georgia",serif;color:#333333'>This:<o:p></o:p></span></p><p style='mso-margin-top-alt:0cm;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<o:p></o:p></span></p><p style='mso-margin-top-alt:0cm;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<o:p></o:p></span></p><p style='mso-margin-top-alt:0cm;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’<o:p></o:p></span></p><p style='mso-margin-top-alt:0cm;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<o:p></o:p></span></p><p style='mso-margin-top-alt:0cm;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<o:p></o:p></span></p><p style='mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:16.8pt;margin-left:0cm;background:white'><span style='font-size:12.0pt;font-family:"Georgia",serif;color:#333333'>```<o:p></o:p></span></p><p style='mso-margin-top-alt:0cm;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:<o:p></o:p></span></p><p style='mso-margin-top-alt:0cm;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<o:p></o:p></span></p><p style='mso-margin-top-alt:0cm;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<o:p></o:p></span></p><p style='mso-margin-top-alt:0cm;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.<o:p></o:p></span></p><p style='mso-margin-top-alt:0cm;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<o:p></o:p></span></p><p style='mso-margin-top-alt:0cm;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.<o:p></o:p></span></p><p style='mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:16.8pt;margin-left:0cm;background:white'><span style='font-size:12.0pt;font-family:"Georgia",serif;color:#333333'>```<o:p></o:p></span></p><p style='mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:16.8pt;margin-left:0cm;background:white'><span style='font-size:12.0pt;font-family:"Georgia",serif;color:#333333'>This can help developer itself, in runtime, not only at development time. “But IDE wouldn’t allow that.” But what if property in required json(node js), is undefined? Some IDEs don’t have JSON intellisense, so this is where it can get annoying.<o:p></o:p></span></p><p style='mso-margin-top-alt:0cm;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><span style='font-size:12.0pt;font-family:"Georgia",serif;color:#333333;background:white'>but things like Flow and Typescript do this today already. <o:p></o:p></span></p><p style='mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:16.8pt;margin-left:0cm;background:white'><span style='font-size:12.0pt;font-family:"Georgia",serif;color:#333333;background:white'>Yes, but they are compile-time only. Meaning, that in runtime, type mutation and unwanted values can happen.<o:p></o:p></span></p><p style='mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:16.8pt;margin-left:0cm;background:white'><span style='font-size:12.0pt;font-family:"Georgia",serif;color:#333333;background:white'>> What's your goal, to have JS engines run Typescript(-like) code natively without transpiling?<o:p></o:p></span></p><p style='mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:16.8pt;margin-left:0cm;background:white'><span style='font-size:12.0pt;font-family:"Georgia",serif;color:#333333;background:white'>First of, this is compiling. TypeScript is higher level than JS, so it’s compiling. Second, TypeScript code is completely compile-time only. Classes(And other ES8+ code), imports, exports and probably namespaces are the only things which are at runtime also.<o:p></o:p></span></p><p style='mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:16.8pt;margin-left:0cm;background:white'><span style='font-size:12.0pt;font-family:"Georgia",serif;color:#333333;background:white'>> What's the point of building this feature into engines? It just provides additional complexity.<o:p></o:p></span></p><p style='mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:16.8pt;margin-left:0cm;background:white'><span style='font-size:12.0pt;font-family:"Georgia",serif;color:#333333;background:white'>I said reasons above. Also as I said, they are optional. Meaning, ne</span><span style='font-size:12.0pt;font-family:"Georgia",serif;color:#333333'>w comers can still learn old js code without static types. Besides, doesn’t async, await, classes and other new stuff add complexity to new people to JS?<o:p></o:p></span></p><p style='mso-margin-top-alt:0cm;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><span style='font-size:12.0pt;font-family:"Georgia",serif;color:#333333;background:white'>Where (when) do you expect types to be checked? Should the engine throw early errors (during parsing)?<o:p></o:p></span></p><p style='mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:16.8pt;margin-left:0cm;background:white'><span style='font-size:12.0pt;font-family:"Georgia",serif;color:#333333;background:white'>Languages normally check types during compile-time. I expect JS to throw</span> errors in runtime, meaning that if you make code <span style='font-size:12.0pt;font-family:"Georgia",serif;color:#333333;background:white'>which would throw type error and it’s untouched, then it doesn’t throw an error.<o:p></o:p></span></p><p style='mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:16.8pt;margin-left:0cm;background:white'><span style='font-size:12.0pt;font-family:"Georgia",serif;color:#333333;background:white'>> What does "static typing" even mean to you in a dynamic scripting language?<o:p></o:p></span></p><p style='mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:16.8pt;margin-left:0cm;background:white'><span style='font-size:12.0pt;font-family:"Georgia",serif;color:#333333;background:white'>Same thing as in real statically typed languages. Type checking.<o:p></o:p></span></p><p style='mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:16.8pt;margin-left:0cm;background:white'><span style='font-size:12.0pt;font-family:"Georgia",serif;color:#333333;background:white'>> and what happens when you introduce new types with `eval` or by loading another script?<o:p></o:p></span></p><p style='mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:16.8pt;margin-left:0cm;background:white'><span style='font-size:12.0pt;font-family:"Georgia",serif;color:#333333;background:white'>Since as I said, they are runtime only type checking.<o:p></o:p></span></p><p style='mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:16.8pt;margin-left:0cm;background:white'><span style='font-size:12.0pt;font-family:"Georgia",serif;color:#333333;background:white'><o:p> </o:p></span></p><p style='mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:16.8pt;margin-left:0cm;background:white'><span style='font-size:12.0pt;font-family:"Georgia",serif;color:#333333;background:white'>> However I would be curious to know if anybody has a usage for them at run time<o:p></o:p></span></p><p style='mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:16.8pt;margin-left:0cm;background:white'><span style='font-size:12.0pt;font-family:"Georgia",serif;color:#333333;background:white'>They have. `eval` can make type mutation(and if it checks the string, you can still overcome them(inputs or array joining)).<o:p></o:p></span></p><p style='mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:16.8pt;margin-left:0cm;background:white'><span style='font-size:12.0pt;font-family:"Georgia",serif;color:#333333;background:white'><o:p> </o:p></span></p><p style='mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:16.8pt;margin-left:0cm;background:white'><span style='font-size:12.0pt;font-family:"Georgia",serif;color:#333333;background:white'>Also, if transpiling and compiling is better, why not leave JS dead? I mean, compilers can do job instead of JS. It’s just basically useless, compilers can do awesome stuff, so “no need for new features in JS”(and then if we did, wasm would take over in web development, or browsers would overcome ES and use something else instead). </span></p></div><div id="DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2"><br />
<table style="border-top: 1px solid #D3D4DE;">
        <tr>
        <td style="width: 55px; padding-top: 13px;"><a href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient" target="_blank"><img src="https://ipmcdn.avast.com/images/icons/icon-envelope-tick-round-orange-animated-no-repeat-v1.gif" alt="" width="46" height="29" style="width: 46px; height: 29px;" /></a></td>
                <td style="width: 470px; padding-top: 12px; color: #41424e; font-size: 13px; font-family: Arial, Helvetica, sans-serif; line-height: 18px;">Virus-free. <a href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient" target="_blank" style="color: #4453ea;">www.avast.com</a>
                </td>
        </tr>
</table><a href="#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2" width="1" height="1"> </a></div></body></html>