Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is TypeScript a superset of ES6?

In other words, is all ES6 syntax covered by TypeScript?

How is my question differente from:

  • "Is TypeScript really a superset of JavaScript?"
    ES6 isn't (or hasn't been considered if you read this in the futur) the current version of Javascript
  • Is Typescript != ES6?
    It's different, I know that, not what I'm asking.
like image 588
Serge Profafilecebook Avatar asked Sep 03 '15 07:09

Serge Profafilecebook


People also ask

Is TypeScript based on ES6?

TypeScript is the ES6 version of JavaScript with some additional features.

Is TypeScript a superset?

TypeScript is a programming language developed and maintained by Microsoft. It is a strict syntactical superset of JavaScript and adds optional static typing to the language. It is designed for the development of large applications and transpiles to JavaScript.

Is ES6 different from TypeScript?

TypeScript is a free and open-source programming language. It is developed and maintained by Microsoft. ES6 is a version of ECMAScript (ES), which is a scripting language specification standardized by ECMA international.

Does TypeScript follow ECMAScript?

Typescript is a compiler that creates ecmascript. The Typescript source is code that has support for types, interfaces, super/subclasses and whatever you know from other programming languages. As mentioned, the result is ecmascript, that runs in any browser.


2 Answers

Based on the current language specification available at the website:

TypeScript is a syntactic sugar for JavaScript. TypeScript syntax is a superset of Ecmascript 5 (ES5) syntax.

And:

TypeScript syntax includes several proposed features of Ecmascript 6 (ES6), including classes and modules.

like image 157
Marty Avatar answered Oct 04 '22 09:10

Marty


TypeScript 1.5 (February 2015) was the last version not to claim to be a superset of ES6:

TypeScript syntax is a superset of Ecmascript 5 (ES5) syntax.

As of TypeScript 1.6 (August 2015):

TypeScript syntax is a superset of ECMAScript 6 (ES6) syntax.

The wording was changed in TypeScript 1.8 (January 2016), but the meaning is the same:

TypeScript syntax is a superset of ECMAScript 2015 (ES2015) syntax.

So, yes: According to the spec, TypeScript is a superset of ES6.

like image 44
Sam Estep Avatar answered Oct 04 '22 10:10

Sam Estep