TypeScript Introduction


In this TypeScript introduction you will learn what is TypeScript, how its work, how to write object oriented concept like class, interface, generic, enum etc, advantage of TypeScript etc.

Introduction to TypeScript

TypeScript is a free and open source programming language developed and maintained by Microsoft. TypeScript is a language that adds object-oriented syntactical flavour to JavaScript. TypeScript is designed to fulfil the needs of the JavaScript developers to build more robust and maintainable large JavaScript code. To use TypeScript you need a build process to compile to JavaScript code. Compiled TypeScript files being deployable where a regular JavaScript application would run.

TypeScript is a superset of JavaScript which provides optional static typing, classes, interfaces, enum, generics etc. It enables developers to write class-based object-oriented programming code for JavaScript. TypeScript can be used to develop JavaScript applications for client-side or server-side (Node.js) execution.

TypeScript syntax includes all features of ECMAScript 2015, which includes classes and modules, and provides the ability to translate these features into ECMAScript 3 compliant code. That means you can use features of ES2015 and beyond, like modules, lambda functions, classes, the spread operator and many more today.

Advantages of TypeScript

  • Enable developer to write large maintainable JavaScript code easy.
  • TypeScript is adopted into major projects like AngularJS 2.0 and Ionic Framework 2.0.
  • Enable developer to express object oriented concepts in standard way by including inheritance, module, class etc.
  • It supports all features of ECMAScript 2015.
  • TypeScript provides command line TSC compiler to manually compile your code.
  • Microsoft Visual Studio now supports "compile on save" for TypeScript files.
  • In built text editor provided by Microsoft Visual Studio 2013 Update 2 and later versions.
  • TypeScript is open source and available on GitHub.
  • TypeScript compiler is implemented in TypeScript and can be used in any JavaScript host.

TypeScript Example

class Customer {
	Name : string;
	constructor (firstName: string, lastName: string)
	{
		this.Name = firstName + "  " + lastName;
	}
	GetName()
	{
		return "Hello, " + this.Name;
	}
}

let cust = new Customer("Jimi","Scott");

let button = document.createElement('button');
button.textContent = "Display Full Name";
button.onclick = function() {
    alert(cust.GetName());
}

document.body.appendChild(button);

Live Demo


See Also

AngularJS Built-in Filters
AngularJS Built-in Directives
AngularJS Expression
AngularJS Built-in Events
AngularJS Scope Methods
AngularJS Built-in Services
AngularJS Controller Inheritance
AngularJS Custom Directives



 
 
SHARE THIS IF YOU LIKE!
submit to reddit

TYPESCRIPT LANGUAGE TECHNIQUES

SUBSCRIBE FOR LATEST UPDATES
HAVE WE CONNECTED ON FACEBOOK?
TOP TUTORIALSTOP CODE EXAMPLESTOP LIVE DEMOLINKSSTAY CONNECTED
HTML Tutorial
HTML5 Tutorial
Bootstrap3 Tutorial
Javascript Tutorial
TypeScript Tutorial
AngularJS Tutorial
CSharp Tutorial
PHP Tutorial
Developer Tools
Javascript
AngularJS
Google MAP API V3
ASP.NET
Javascript
AngularJS
Google MAP API V3
Contact Us
Advertise with Us
Privacy Policy
Disclaimer
Stay connected. We actually like you. If you want to get up to the minute updates, then connect with us on your fav below.
 
Twitter   Linkedin   Facebook   Google+    RSS   Pinterest
 
Protected by Copyscape Original Content Checker
 
 
Copyright ©2017 www.techstrikers.com Unauthorized reproduction/replication of any part of this site is prohibited.