1. Introduction
TypeScript is a free and open source programming language developed by Microsoft. It is a superset of JavaScript and essentially adds optional static types and class-based object-oriented programming to the language.
Typescript is a compile-to-javascript language.
Typescript extends the syntax of JavaScript, so existing JavaScript programs can work without modification and directly under Typescript. At the same time, typescript compiles javascript to ensure compatibility.
2. Features & Advantages
2.1. Compatible with existing JS code
2.2, type system, object-oriented design, ensure the robustness of the program (compile check)
2.3. Good grammar, good tool support
2.4. Good community support
3. Quick Start
3.1. Tools
If it is a vs development, install TypeScript 1.4 for Visual Studio 2013, the version changes at any time, it is recommended to download the latest version.
If it is a NPM user, then directlynpm install -g typescript
3.2. Hello Jay
For users with VS, create a new item directly (TypeScript file); If the IDE supports TYPESCRIPT, create a new TypeScript, or create a new text file with a suffix named ts. If it is not possible to compile in the IDE, you can use TSC filename.ts to compile the typescript after installing it directly from NPM.
Open a 1.ts file and enter:
function hello(name: string){ return ‘Hello,‘ + name;}var res = hello(‘Jay‘);console.log(res);
tsc 1.tsafter execution, generate a 1.js file (a standard JS file with readability):
function hello(name) { return ‘Hello,‘ + name;}var res = hello(‘Jay‘);console.log(res);
4. References
1. Official website: http://www.typescriptlang.org/
2. Getting Started Guide: https://github.com/vilic/typescript-guide
Typescript notes: First experience