Introduction to TypeScript
TypeScript Tutorial will launch in
[ujicountdown id=”comming-soon” expire=”2019/03/22 00:00″ hide=”true” url=”” subscr=”” recurring=”” rectype=”second” repeats=””]
Want to be notified when the course launches?
TypeScript was first released in October 2012.
Features of TypeScript
- In TypeScript, third-party header files libraries are also present such as jQuery, MongoDB, and D3.js.
History of TypeScript
TypeScript launched version 0.8 in October 2012. It took 2 years for Anders Hejlsberg, Delphi and Turbo Pascal to develop TypeScript at Microsoft. The language was praised By a Mexican programmer, Miguel de Icaza.
In 2013, version 0.9 was launched with new features. The TypeScript was supported by other IDEs, such as Eclipse using plug-in provided by Palantir Technologies. It was also supported by several text editors such as Sublime, Vim and Emacs.
In 2014, version 1.0 was released. In July 2014, a new compiler was developed. New compiler brings five times gains in performance. The source code for TypeScript was originally hosted by CodePlex, was shifted to Github.
In 2016, version 2.0 was released, with several features, like the ability to optionally prevent variables from being assigned null values.
TypeScript and ECMAScript
ECMAScript is standard specification of a scripting language. There are several versions of ECMAScript. “Harmony” is the version 6. TypeScript uses ECMAScript6 specification. TypeScript uses basic language features from the ECMAScript5 specification. TypeScript has features like Modules and class-based orientation with the EcmaScript 6 specification.
Type System is used to represent different types of values which are supported by the language. It is used to check validity of supplied value before storing or manipulating the program.
Following are the types of data types in TypeScript:
The Any type
It is the super type of all types in TypeScript. It is also denoted as dynamic type.
|Number||number||Double precision 64-bit floating point values. It can be used to represent both, integers and fractions.|
|String||string||Represents a sequence of Unicode characters.|
|Boolean||boolean||Represents logical values, true and false.|
|Void||Void||Used on function return types to represent non-returning functions.|
|Null||Null||Represents an intentional absence of an object value.|
|Undefined||undefined||Denotes value given to all uninitialized variables.|
It includes Enumerations (enums), classes, interfaces, arrays, and tuple.
Components of TypeScript
There are three components in TypeScript:
It checks syntax, keywords, and type annotations.
- The TypeScript Compiler
- The TypeScript Language Service
It has an additional layer of core compiler that are editor-like applications.
Features of TypeScript
- TypeScript supports other JS libraries.
This means that .js file can be renamed to .ts and compiled with other TypeScript files.
- TypeScript is portable.
It is portable in browsers, devices, and operating systems.
Advantage of TypeScript
- Code written in TypeScript is more predictable due to static typing and also it is easy to debug.
- Easy to organize code for very large and complicated apps, due to modules, namespaces and strong OOP support.
- Angular2 framework is written in TypeScript.
Disadvantage of TypeScript
- Learning Curve
- Needs Development Tools
Visitors do not require any plugin to run TypeScript but developers require special tools in editor or IDE.
- Cannot easily be edited by Content Management Systems (CMS)
If Content Management Systems is used in developing a website, .css style files and .js script files can be edited in the admin portal but in TypeScript, it is not easy to edit. You need extra plugins to edit.