What is TypeScript?
TypeScript is a typed superset of Javascript. It provides a manageable OOP way to write code with Javascript. It has OOP concepts that provides a simple way to write code at client end.Significance
Javascript was designed to provide actions on browser and never intended to work on large scale applications and now a days people are writing thousands or millions of lines in a single large application and JavaScript doesnot have such type of great features to help a large scale application like classes, modules,inheritence,generics therefore writing code for large scale application is hard and this is first target Typescript is following. It provides a way to write your client end code in more effective and scalable way.All Browsers and All Platforms Support |
Download and Installation for Visual Studio 2012
http://www.microsoft.com/en-in/download/details.aspx?id=34790 After downloading plugin from this link install it and it will create a template in the Visual Studio
Template
TypeScript Template |
Fact: TypeScript is open source and there is no relation with any editor or .Net framework and can run with any framework or technology and with any development editor.
Implementation and First Demo in TypeScript using Visual Studio 2012
Step 1
TypeScript Template |
After clicking on OK button we will have a already designed template in TypeScript like this below screen.
Built In Template By Visual Studio 2012 for TypeScript |
TypeScript, JavaScript and HTML Markup |
When you will run this application you will see Hello TypeScript on the Browser.
TypeScript File Source Code
function HelloWorld() { return "Hello TypeScript!!!" } window.onload = () => { var el = document.getElementById('content'); el.innerHTML = HelloWorld(); };
Javascript Source Code:
function HelloWorld() { return "Hello TypeScript!!!"; } window.onload = function () { var el = document.getElementById('content'); el.innerHTML = HelloWorld(); }; //# sourceMappingURL=app.js.map
Index.html Source Code
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <title>TypeScript HTML App</title> <link rel="stylesheet" href="app.css" type="text/css" /> <script src="app.js"></script> </head> <body> <h1>TypeScript HTML App</h1> <div id="content"></div> </body> </html>
I will explore more in depth about TypeScript in my next Articles on TypeScript.
Happy Coding...
great
ReplyDelete