Similar presentations:
TypeScript In-Depth: Intro
1.
TypeScript In-Depth:Intro
CONFIDENTIAL
1
2.
Course OverviewCONFIDENTIAL
Intro
Types
Functions
Interfaces
Classes
Modules
Generics
Decorators
Asynchronous
Patterns
2
3.
History1.
2.
3.
4.
5.
CONFIDENTIAL
2012
Anders Hejlsberg (TypeScript, Delphi, C#)
Microsoft
Open Source
Flexibility and High Performance
3
4.
TypeScriptTypeScript
…
ES2016
ES2015
ES5
CONFIDENTIAL
4
5.
How It Works1. TypeScript – language with static type checking and
compilation to JavaScript
2. We can set JavaScript version in TypeScript
configuration (tsconfig.json: --target)
3. TypeScript supports compilation to the following
JavaScript versions:
CONFIDENTIAL
ESNext
ES2015 - ES2018
ES5
ES3 (default)
5
6.
TYPESCRIPT COMPILERfirst.ts
var x: number;
class HelloWorld {}
CONFIDENTIAL
first.js
var x;
function HelloWorld
{}
6
7.
TypeScript → JavaScriptTypeScript
JavaScript (ES5)
Encapsulation
class Greeter {
greeting: string;
constructor (message: string) {
this.greeting = message;
}
greet() {
return “Hello, ” + this.greeting;
}
}
CONFIDENTIAL
Static Typing
var Greeter = (function() {
function Greeter(message) {
this.greeting = message;
}
Greeter.prototype.greet = function() {
return “Hello, ” + this.greeting;
};
return Greeter;
})();
7
8.
Get TypeScriptCONFIDENTIAL
8
9.
IDE with TypeScript SupportCONFIDENTIAL
9
10.
WHAT IS TSLINT?CONFIDENTIAL
10
11.
What is TSLint?1. Conceptually similar to popular
JavaScript linters
JSLint
ESLint
2.
3.
4.
5.
Installed with npm
Rules stored in tslint.json file
Executed from a command line
TSLint extension available for Visual
Studio Code
6. Plugins are available for other
editors
CONFIDENTIAL
11
12.
HOW TO INSTALL, CONFIGURE AND USE TSLINTCONFIDENTIAL
12
13.
TSLint InstallWebsite:
https://palantir.github.io/tslint/
Global installation
$ npm install tslint –g
Configuration
tslint --init
Use it
tslint [options] [file…]
gulp-tslint
CONFIDENTIAL
13
14.
EXTENSION FOR VISUAL STUDIO CODECONFIDENTIAL
14
15.
Extension for Visual Studio CodeCONFIDENTIAL
15