Typescript - MentorMate Academy

27
Typescript

Transcript of Typescript - MentorMate Academy

Typescript

Topics Today

● What is Typescript ?● Installation● Demo Session● Typescript Benefits

What is Typescript ?

TypeScript: JavaScript that scales

A statically typed superset of JavaScript that compiles to plain JavaScript

Any browser. Any host. Any OS.

Open Source.

The feature gap

Javascript

Evolution

ES3 ES5 ES 2015

ES 2016

ES 2017

ES 2018

ES 2019

State of the art JS

State of

Server JS

State of

Web JS

2015

JavaScript feature gapTarget Productivity

The feature gap

Javascript

Evolution

ES3 ES5 ES 2015

ES 2016

ES 2017

ES 2018

ES 2019

State of the art JS

State of

Server JS

State of

Web JS

2016

Target ProductivityJavaScript feature gap

Installation

npm install -g typescript

tsc helloworld.ts

npm install -g typings

TypescriptBenefits

ObjectOriented programming

.Net Developers

Large teams and applications

Switch between es5 and es6

The TypeScript Definition Manager

New featuresEcmaScript 2015 supporttsconfig.json filesTS Server language serviceDecoratorsLocal typesGeneric type aliasesUser defined type guard functionsJSX supportIntersection typesAbstract classes and methodsES2016 exponentiation operatorPolymorphic this typeAsync/awaitthis-based type guardsImproved checking of for-in statements

Reachability analysisChecking of destructuring with literal initializersJavaScript in TypeScript compilationsString literal typesSateless function components in JSXSupport for F-bounded polymorphismJSDoc support in JavaScript filesSupport for default import interop with SystemJSRecognize constructor functions in JavaScript filesModule augmentationsSupport for custom JSX factoriesNon-nullable types

0 1 2 42 0.25

‘a’, ‘b’, ‘hello’

true or false

number

string

boolean

undefined

undefined

null

null

Non-nullable types

Union types

0 1 2 42 0.25

number

‘a’, ‘b’, ‘hello’

string

null

null

number | string | null

“We love TypeScript for many things… With TypeScript, several of our team members have said things like 'I now actually understand most of our own code!' because they can easily traverse it and understand relationships much better. And we’ve found several bugs via TypeScript’s checks.”

— Brad Green, Engineering Director - AngularJS

“One of Ionic's main goals is to make app development as quick and easy as possible, and the tooling support TypeScript gives us with autocompletion, type checking and source documentation really aligns with that.”

— Tim Lancina, Tooling Developer - Ionic

Questions