typescriptVsES6
typescriptVsES6
TypeScript
TypeScript is an open-source pure object-oriented programing language. It is a strongly
typed superset of JavaScript which compiles to plain JavaScript. TypeScript is developed
and maintained by Microsoft under the Apache 2 license. It is not directly run on the
browser. It needs a compiler to compile and generate in JavaScript file. TypeScript source
file is in ".ts" extension. We can use any valid ".js" file by renaming it to ".ts" file.
TypeScript is the ES6 version of JavaScript with some additional features.
History of TypeScript
Anders Hejlsberg developed TypeScript. It was first introduced for the public in the
month of 1 October 2012. After two years of internal development at Microsoft, the new
version of TypeScript 0.9 was released in 2013. The current version of TypeScript
is TypeScript 3.4.5 which was released on 24 April 2019.
ES6
ECMAScript (ES) is a scripting language specification standardized by ECMA
international. It was created to standardize JavaScript. The ES scripting language
contains many implementations, and the most popular is JavaScript. The developers
use ECMAScript mostly for client-side scripting of World Wide Web (WWW).
The sixth edition of ECMAScript standard is ECMAScript6 or ES6 and later renamed
as ECMAScript 2015. It is a major enhancement to the JavaScript language, which
allows us to write programs for complex applications. It adds many features intended to
make large-scale software development easier. The most common ES6 web-browsers
are Chrome and Firefox. A transpiler converts the ES6 based code into ES5 which is
supported many browsers. TypeScript is a transpiler. Grunt, Gulp, and Babel are some
other transpilers to compile the modules. Therefore, TypeScript supports ES6.
History
JavaScript introduced in May 1995 by Brendan Eich. It was initially called Mocha, a
name chosen by Netscape founder Marc Andreessen, and later renamed
to LiveScript. At the same time, Sun Microsystems owned the trademark for
JavaScript. In December 1995, Netscape acquired a trademark license and renamed it
to JavaScript.
In between 1996 and 1997, Netscape took JavaScript to the ECMA standards
organization to maintain a specification for the language. In June 1997, the ECMA
Technical Committee 39 (TC39) was created to continue to evolve the language,
eventually releasing ECMA-262 Ed.1.
The first standard version of JavaScript was ECMAScript 1 was released on June 1997.
After a year later, ECMAScript 2 was released, which contains only minor changes to
keep a parallel ISO standard for JavaScript. In December 1999, ECMAScript 3 was
released, which introduces a lot of popular features of JavaScript. In December 2009,
ECMAScript or ES6 was published and subsequently renamed to ECMAScript 2015.
TypeScript vs. ES6
TypeScript ES6
Data-Types TypeScript supports all primitive ES6 does not support all data types.
data types.
Features TypeScript contains features such ES6 does not support these features.
as generics and type annotations,
Inference, Enums, and Interfaces.
Modules TypeScript Modules are of two We can classify the ES6 modules in
types: two ways:
1. Internal 1. Importing a module
2. External modules 2. Exporting a module
Loop Typescript and ES6 both are having Typescript and ES6 both are having
same loops. same loops.
1. Definite 1. Definite
2. Indefinite 2. Indefinite
Why choose The developers choose TypeScript: The developers choose ES6:
o Typesafe o ES6 code is shorter than
o JavaScript superset traditional JS
Company The list of companies which uses The list of companies which uses ES6
using TypeScript are: are:
o Slack o Slack
o Asana o StackShare
o CircleCI o eBay
o Intuit o Asana
o Swat.io o Intuit
o Avocode o Swat.io