What is Typescript?
Typescript
is a strongly typed
, object-oriented
, structured
, functional
and compiled
language. It was created by Anders Hejlsberg
(designer of C#) at Microsoft. Typescript
is both a set of tools and a language and. It is JavaScript with some additional features.
It is a statically compiled language to write correct and simple JavaScript code.
In other words, TypeScript
is a superset of JavaScript
, which means that it builds on top of JavaScript’s mature foundations,
adding a variety of helpful syntax and tooling onto the language. It brings the power and productivity of static typing and
object-oriented development techniques to the core JavaScript language and enables other programs to use the values defined
in the files. Actually, TypeScript
is designed to be compiled into fully-compatible JavaScript.
Why TypeScript is developed while having JavaScript?
When JavaScript
was developed then its development team introduced JavaScript as a client-side programming language only.
But when people started using JavaScript then developer get to know that JavaScript can also be used as a server-side programming language.
When JavaScript was extending then the code of JavaScript became complex and heavy. Because of this, JavaScript was not even able to fulfill
the requirement of Object-oriented programming language which prevents JavaScript from succeeding at the enterprise level as a server-side technology.
After that, to bridge this gap TypeScript was developed by the development team.
History of Typescript
Let see the important points from the History of Typescript:
In October 2012
, the typescript was first made public after two years of internal development at Microsoft at version 0.8.In 2013
, TypeScript 0.9 released which added support for generic.In 2014
, TypeScript 1.0 was released at Microsoft's Build developer conference.In July 2014
, a new TypeScript compiler came which is five times faster then it's earlier versions.On 22 September 2016
, TypeScript 2.0 was released which introduced several features.In March 2018
, conditional types, the improved key with intersection types supports added in the Typescript.
Features of Typescript
Lets see the important landmark in the history of Javascript:
- TypeScript Code is converted into Plain JavaScript Code: TypeScript code is not understandable by the browsers that's why if the code is written in TypeScript then it is compiled and converted the code i.e. translate the typescript code into JavaScript. This process is known as Trans-piled. With the help of JavaScript code, browsers are able to read the code and display.
- JavaScript is a subset of TypeScript: Whatever code is written in JavaScript can be converted to TypeScript by simply changing the extension from .js to .ts.
- TypeScript can be used anywhere: TypeScript code can run on any browser, devices or in any operating system. TypeScipt is not specific to any Virtual-machine etc.
- TypeScript supports JS libraries: With the support of TypeScript, developers can use existing JavaScript code, include popular JavaScript libraries, and can be called from other JavaScript code too.
TypeScript and ECMAScript
The ECMAScript
is a specification of the scripting language standardized by ECMA International in ECMA-262
.
There are nine editions published of ECMA-262 where version 4 of the standard is codenamed Harmony
.
TypeScript is aligned with the ECMAScript specification.
TypeScript
adopts its basic language features from the ECMAScript5 specification, commonly referred to as JavaScript.
TypeScript adds support features like Modules, class-based orientation, and an arrow function syntax as described in
the ECMAScript 2015 specification.TypeScript is a language extension that adds features to ECMAScript 6 whereas it
also includes features like generics, tuples, namespaces,
type annotations and many more that aren’t a part of the ECMAScript 6 specification.