Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there support for static typing in ECMAScript 6 or 7?

Is there any support for static typing in ECMAScript 6? How about ECMAScript 7?

like image 325
Mojtaba Avatar asked Mar 14 '14 14:03

Mojtaba


People also ask

Does JavaScript support static typing?

In the JavaScript community, Flow and TypeScript have emerged as the two main options for enabling static type checking: Flow is a static type checker for JavaScript. It is an open-source tool developed by Facebook. TypeScript is a statically typed superset of JavaScript that compiles to plain JavaScript.

Will ECMAScript have types?

The ECMAScript language types are Undefined, Null, Boolean, String, Number, and Object. Now, if you're a fan of strongly typed (statically typed) languages, you may object to this usage of the word “type.” In those languages, “type” means a whole lot more than it does here in JS.

What is static typing in JavaScript?

If you don't know, static typing is when the compiler enforces that values use the same type. Here's an example. This is valid in JavaScript: let value = 5; value = "hello"; Here, the type of value changes from a number to a string.


1 Answers

No.

But on the ECMA-Script Wikipage there is a paragraph about changes in ECMA-Script 7:

The Seventh Edition is in a very early stage of development, but is intended to continue the themes of language reform, code isolation, control of effects and library/tool enabling from ES6. New features proposed include promises/concurrency, number and math enhancements, guards and trademarks (an alternative to static typing), operator overloading, value types (first-class number-like objects), new record structures (records, tuples and typed arrays), pattern matching, and traits.

Which may interest you.

like image 142
Daniel Müller Avatar answered Sep 21 '22 04:09

Daniel Müller