2.17M
Категория: ПрограммированиеПрограммирование

TypeScript In-Depth: Intro

1.

TypeScript In-Depth:
Intro
CONFIDENTIAL
1

2.

Course Overview
CONFIDENTIAL
Intro
Types
Functions
Interfaces
Classes
Modules
Generics
Decorators
Asynchronous
Patterns
2

3.

History
1.
2.
3.
4.
5.
CONFIDENTIAL
2012
Anders Hejlsberg (TypeScript, Delphi, C#)
Microsoft
Open Source
Flexibility and High Performance
3

4.

TypeScript
TypeScript

ES2016
ES2015
ES5
CONFIDENTIAL
4

5.

How It Works
1. 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 COMPILER
first.ts
var x: number;
class HelloWorld {}
CONFIDENTIAL
first.js
var x;
function HelloWorld
{}
6

7.

TypeScript → JavaScript
TypeScript
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 TypeScript
CONFIDENTIAL
8

9.

IDE with TypeScript Support
CONFIDENTIAL
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 TSLINT
CONFIDENTIAL
12

13.

TSLint Install
Website:
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 CODE
CONFIDENTIAL
14

15.

Extension for Visual Studio Code
CONFIDENTIAL
15
English     Русский Правила