SlideShare uma empresa Scribd logo
1 de 31
Introduction to TypeScript
Udayakumar Mathivanan
Cloud Solution Architect
Your Logo
AGENDA
Why TypeScript?
Language introduction / live-coding
TypeScript and Angular
Comparison with TS alternatives
Conclusion
Your Logo
WHAT'S WRONG WITH JAVASCRIPT?
Dynamic typing
Lack of modularity
Verbose patterns (IIFE)
In short: JavaScript development scales badly
Your Logo
WHAT'S GOOD ABOUT JAVASCRIPT?
It's everywhere
Huge amount of libraries
Flexible
Your Logo
WISHLIST
Scalable HTML5 clientside development
Modular development
Easily learnable for Java developers
Non-invasive (existing libs, browser support)
Long-term vision
Clean JS output (exit strategy)
Your Logo
TYPESCRIPT
In short: Lightweight productivity booster
Superset of JavaScript
Optionally typed
Compiles to ES3/ES5
No special runtime
1.0 in April 2014, future ES6 alignment
Your Logo
GETTING STARTED
$ npm install -g typescript
$ mv mycode.js mycode.ts
$ tsc mycode.ts
OPTIONAL TYPES
Type annotations
> var a = 123
> a.trim()
TypeError: undefined is
not a function
J
S
= 123> var a: string
> a.trim()
'number'Cannot convert
to 'string'.
TS
Type inference
Types dissapear at runtime
> var a = 123
> a.trim()
The property
not exist on
'trim' does
value of
type 'number'.
Your Logo
boolean number string type[]any void
Object void boolean integer
long
short
...
String
char
Type[]
OPTIONAL TYPES
Your Logo
OPTIONAL TYPES
Types are structural rather than nominal
TypeScript has function types:
var
find:
(elem: string, elems: string[]) => string =
function(elem, elems) {
..
}
Your Logo
INTERFACES
MyInterface {
signature
interface
// Call
(param:
member:
number): string
number
optionalMember?: number
myMethod(param: string): void
MyInterface = ...
}
var instance:
instance(1)
Your Logo
INTERFACES
Use them to describe data returned in REST calls
User) => {$.getJSON('user/123').then((user:
showProfile(user.details)
}
Your Logo
INTERFACES
TS interfaces are open-ended:
interface JQuery {
appendTo(..): ..
..
}
interface JQuery {
draggable(..): ..
..
}jquery.d.t
s
jquery.ui.d.t
s
OPTIONAL TYPES: ENUMS
enum Language { TypeScript, Java, JavaScript }
Language.TypeScriptvar lang =
var ts = Language[0]
ts === "TypeScript"
enum Language { TypeScript = 1, Java, JavaScript }
var ts = Language[1]
TYPESCRIPT CLASSES
Can implement interfaces
Inheritance
Instance methods/members
Static methods/members
Single constructor
Default/optional parameters
ES6 class syntax
similar
different
Your Logo
ARROW FUNCTIONS
Implicit return
No braces for single expression
Part of ES6
function(arg1) {
return arg1.toLowerCase();
}
(arg1) => arg1.toLowerCase();
Lexically-scoped this (no more 'var that = this')
Your Logo
string): void }
module StorageModule {
export interface Storage { store(content:
var privateKey = 'storageKey';
export class LocalStorage implements Storage {
store(content: string): void {
localStorage.setItem(privateKey, content);
}
}
export class DevNullStorage Storage {
store(content: string):
implements
void { }
}
= new StorageModule.LocalStorage();
}
var storage: StorageModule.Storage
storage.store('testing');
INTERNAL MODULES
Your Logo
string): void }
module StorageModule {
export interface Storage { store(content:
var privateKey = 'storageKey';
export class LocalStorage implements Storage {
store(content: string): void {
localStorage.setItem(privateKey, content);
}
}
export class DevNullStorage Storage {
store(content: string):
implements
void { }
}
= new StorageModule.LocalStorage();
}
var storage: StorageModule.Storage
storage.store('testing');
INTERNAL MODULES
Your Logo
INTERNAL MODULES
TS internal modules are open-ended:
module
export class
Webshop {
Cart
}
/// <reference
module Webshop
path="cart.ts" />
{
export class
}
{ .. }
cart.ts
Catalog { .. }
main.ts
Your Logo
INTERNAL MODULES
TS internal modules are open-ended:
module
export class
Webshop {
Cart
}
/// <reference
module Webshop
path="cart.ts" />
{
export class
}
{ .. }
cart.ts
Catalog { .. }
main.ts
Can be hierarchical:
module Webshop.Cart.Backend {
...
}
Combine modules:
$ tsc --out main.js main.ts
Your Logo
BUILDING TYPESCRIPT
$ tsc -watch main.ts
grunt-typescript
grunt-ts
gulp-type (incremental)
gulp-tsc
Your Logo
TOOLING
IntelliJ IDEA
WebStorm
plugin
Your Logo
WHO USES TYPESCRIPT?
(duh)
TypeScript
Copy JS code Into TS file Compile to JavaScript
• TypeScript is a typed superset of JavaScript that compiles to plain JavaScript.
• TypeScript is a language for application scale JavaScript development.
• Any browser. Any host. Any OS.
• Open Source.
~typescriptlang.org
JS JSTS
TypeScript Key Features
• Support standard JavaScript code with static typing
• Zero cost: Static types completely disappear at run-time
• Encapsulation though classes, modules and interfaces
• Constructors, properties and functions (public, private)
• Enums
• Lambda and generics support
• Intellisense and syntax checking
• IDE support
• Visual Studio
• Sublime Text, Vi, Emacs
• Eclipse, WebStorm
• Preview Pane – Web Essentials
Highlights
Tool Features TypeScript Code
• Type Annotation
• Any and Primitive Type
• Interface, Implementation
• Class, constructor
• Opt. Parameter, overloads
• Event handler
• Get accessor, private, static
• Arrow function, lambda
• Module
• Typed definitions
• And more…
• Type Inference
• Intellisense, statement comp.
• Compile on Save
• Preview Pane
• ECMAScript version
• Redirect JavaScript output
• Generate declaration files
TypeScript Versions
• TypeScript 1.3 for VS older (Web Essentials)
• TypeScript 1.3 for VS 2013 Update 2
• TypeScript 1.4 for VS 2013
• TypeScript 1.4 for VS 2015 CTP5
• TypeScript 2.0 (vNext)
Your Logo
CONCLUSION
TypeScript allows for gradual adoption
Internal modules
Classes/Interfaces
Some typing
External modules
Type defs
More typing
Generics
Type defs
-noImplicitAny
Resources
• http://www.typescriptlang.org
• http://www.typescriptlang.org/Content/TypeScript%20Languag
e%20Specification.pdf
• http://www.typescriptlang.org/Playground
• http://vswebessentials.com/download
• https://github.com/borisyankov/DefinitelyTyped
• https://github.com/Microsoft/TypeScript
Angular 2: Built on TypeScript
• http://blogs.msdn.com/b/typescript/archive/2015/03/05/angul
ar-2-0-built-on-typescript.aspx
• http://blogs.msdn.com/b/visualstudio/archive/2015/03/12/a-
preview-of-angular-2-and-typescript-in-visual-studio.aspx
Summary
• Open source language that compiles into JavaScript
• Code encapsulation
• Maintainable code
• Tooling support
Application scale JavaScript development is hard
TypeScript makes it easier

Mais conteúdo relacionado

Mais procurados

TypeScript Introduction
TypeScript IntroductionTypeScript Introduction
TypeScript IntroductionDmitry Sheiko
 
Why TypeScript?
Why TypeScript?Why TypeScript?
Why TypeScript?FITC
 
Angular directives and pipes
Angular directives and pipesAngular directives and pipes
Angular directives and pipesKnoldus Inc.
 
Unit 1 - TypeScript & Introduction to Angular CLI.pptx
Unit 1 - TypeScript & Introduction to Angular CLI.pptxUnit 1 - TypeScript & Introduction to Angular CLI.pptx
Unit 1 - TypeScript & Introduction to Angular CLI.pptxMalla Reddy University
 
Type script - advanced usage and practices
Type script  - advanced usage and practicesType script  - advanced usage and practices
Type script - advanced usage and practicesIwan van der Kleijn
 
ES2015 / ES6: Basics of modern Javascript
ES2015 / ES6: Basics of modern JavascriptES2015 / ES6: Basics of modern Javascript
ES2015 / ES6: Basics of modern JavascriptWojciech Dzikowski
 
Modules in AngularJs
Modules in AngularJsModules in AngularJs
Modules in AngularJsK Arunkumar
 
Javascript variables and datatypes
Javascript variables and datatypesJavascript variables and datatypes
Javascript variables and datatypesVarun C M
 
Angular - Chapter 2 - TypeScript Programming
Angular - Chapter 2 - TypeScript Programming  Angular - Chapter 2 - TypeScript Programming
Angular - Chapter 2 - TypeScript Programming WebStackAcademy
 
The New JavaScript: ES6
The New JavaScript: ES6The New JavaScript: ES6
The New JavaScript: ES6Rob Eisenberg
 

Mais procurados (20)

TypeScript Overview
TypeScript OverviewTypeScript Overview
TypeScript Overview
 
TypeScript Introduction
TypeScript IntroductionTypeScript Introduction
TypeScript Introduction
 
Why TypeScript?
Why TypeScript?Why TypeScript?
Why TypeScript?
 
TypeScript
TypeScriptTypeScript
TypeScript
 
TypeScript VS JavaScript.pptx
TypeScript VS JavaScript.pptxTypeScript VS JavaScript.pptx
TypeScript VS JavaScript.pptx
 
TypeScript
TypeScriptTypeScript
TypeScript
 
Introduction to TypeScript
Introduction to TypeScriptIntroduction to TypeScript
Introduction to TypeScript
 
Angular directives and pipes
Angular directives and pipesAngular directives and pipes
Angular directives and pipes
 
TypeScript intro
TypeScript introTypeScript intro
TypeScript intro
 
Java script
Java scriptJava script
Java script
 
Unit 1 - TypeScript & Introduction to Angular CLI.pptx
Unit 1 - TypeScript & Introduction to Angular CLI.pptxUnit 1 - TypeScript & Introduction to Angular CLI.pptx
Unit 1 - TypeScript & Introduction to Angular CLI.pptx
 
Angularjs PPT
Angularjs PPTAngularjs PPT
Angularjs PPT
 
Type script - advanced usage and practices
Type script  - advanced usage and practicesType script  - advanced usage and practices
Type script - advanced usage and practices
 
Angular overview
Angular overviewAngular overview
Angular overview
 
Angular js PPT
Angular js PPTAngular js PPT
Angular js PPT
 
ES2015 / ES6: Basics of modern Javascript
ES2015 / ES6: Basics of modern JavascriptES2015 / ES6: Basics of modern Javascript
ES2015 / ES6: Basics of modern Javascript
 
Modules in AngularJs
Modules in AngularJsModules in AngularJs
Modules in AngularJs
 
Javascript variables and datatypes
Javascript variables and datatypesJavascript variables and datatypes
Javascript variables and datatypes
 
Angular - Chapter 2 - TypeScript Programming
Angular - Chapter 2 - TypeScript Programming  Angular - Chapter 2 - TypeScript Programming
Angular - Chapter 2 - TypeScript Programming
 
The New JavaScript: ES6
The New JavaScript: ES6The New JavaScript: ES6
The New JavaScript: ES6
 

Destaque

WordPress REST API + React + TypeScript
WordPress REST API + React + TypeScriptWordPress REST API + React + TypeScript
WordPress REST API + React + TypeScriptBorek Bernard
 
React + Redux + TypeScript === ♥
React + Redux + TypeScript === ♥React + Redux + TypeScript === ♥
React + Redux + TypeScript === ♥Remo Jansen
 
React + Redux Introduction
React + Redux IntroductionReact + Redux Introduction
React + Redux IntroductionNikolaus Graf
 
TypeScript: Angular's Secret Weapon
TypeScript: Angular's Secret WeaponTypeScript: Angular's Secret Weapon
TypeScript: Angular's Secret WeaponLaurent Duveau
 
Александр Русаков - TypeScript 2 in action
Александр Русаков - TypeScript 2 in actionАлександр Русаков - TypeScript 2 in action
Александр Русаков - TypeScript 2 in actionMoscowJS
 
TypeScript - Silver Bullet for the Full-stack Developers
TypeScript - Silver Bullet for the Full-stack DevelopersTypeScript - Silver Bullet for the Full-stack Developers
TypeScript - Silver Bullet for the Full-stack DevelopersRutenis Turcinas
 
«Typescript: кому нужна строгая типизация?», Григорий Петров, MoscowJS 21
«Typescript: кому нужна строгая типизация?», Григорий Петров, MoscowJS 21«Typescript: кому нужна строгая типизация?», Григорий Петров, MoscowJS 21
«Typescript: кому нужна строгая типизация?», Григорий Петров, MoscowJS 21MoscowJS
 
TypeScript for Java Developers
TypeScript for Java DevelopersTypeScript for Java Developers
TypeScript for Java DevelopersYakov Fain
 
TypeScript Seminar
TypeScript SeminarTypeScript Seminar
TypeScript SeminarHaim Michael
 
Power Leveling your TypeScript
Power Leveling your TypeScriptPower Leveling your TypeScript
Power Leveling your TypeScriptOffirmo
 
TypeScript: Un lenguaje aburrido para programadores torpes y tristes
TypeScript: Un lenguaje aburrido para programadores torpes y tristesTypeScript: Un lenguaje aburrido para programadores torpes y tristes
TypeScript: Un lenguaje aburrido para programadores torpes y tristesMicael Gallego
 
Typescript tips & tricks
Typescript tips & tricksTypescript tips & tricks
Typescript tips & tricksOri Calvo
 
Angular 2 - Typescript
Angular 2  - TypescriptAngular 2  - Typescript
Angular 2 - TypescriptNathan Krasney
 
TypeScript: особенности разработки / Александр Майоров (Tutu.ru)
TypeScript: особенности разработки / Александр Майоров (Tutu.ru)TypeScript: особенности разработки / Александр Майоров (Tutu.ru)
TypeScript: особенности разработки / Александр Майоров (Tutu.ru)Ontico
 
Typescript + Graphql = <3
Typescript + Graphql = <3Typescript + Graphql = <3
Typescript + Graphql = <3felixbillon
 

Destaque (18)

React & Redux
React & ReduxReact & Redux
React & Redux
 
WordPress REST API + React + TypeScript
WordPress REST API + React + TypeScriptWordPress REST API + React + TypeScript
WordPress REST API + React + TypeScript
 
React + Redux + TypeScript === ♥
React + Redux + TypeScript === ♥React + Redux + TypeScript === ♥
React + Redux + TypeScript === ♥
 
React + Redux Introduction
React + Redux IntroductionReact + Redux Introduction
React + Redux Introduction
 
TypeScript: Angular's Secret Weapon
TypeScript: Angular's Secret WeaponTypeScript: Angular's Secret Weapon
TypeScript: Angular's Secret Weapon
 
TypeScript
TypeScriptTypeScript
TypeScript
 
Александр Русаков - TypeScript 2 in action
Александр Русаков - TypeScript 2 in actionАлександр Русаков - TypeScript 2 in action
Александр Русаков - TypeScript 2 in action
 
Typescript
TypescriptTypescript
Typescript
 
TypeScript - Silver Bullet for the Full-stack Developers
TypeScript - Silver Bullet for the Full-stack DevelopersTypeScript - Silver Bullet for the Full-stack Developers
TypeScript - Silver Bullet for the Full-stack Developers
 
«Typescript: кому нужна строгая типизация?», Григорий Петров, MoscowJS 21
«Typescript: кому нужна строгая типизация?», Григорий Петров, MoscowJS 21«Typescript: кому нужна строгая типизация?», Григорий Петров, MoscowJS 21
«Typescript: кому нужна строгая типизация?», Григорий Петров, MoscowJS 21
 
TypeScript for Java Developers
TypeScript for Java DevelopersTypeScript for Java Developers
TypeScript for Java Developers
 
TypeScript Seminar
TypeScript SeminarTypeScript Seminar
TypeScript Seminar
 
Power Leveling your TypeScript
Power Leveling your TypeScriptPower Leveling your TypeScript
Power Leveling your TypeScript
 
TypeScript: Un lenguaje aburrido para programadores torpes y tristes
TypeScript: Un lenguaje aburrido para programadores torpes y tristesTypeScript: Un lenguaje aburrido para programadores torpes y tristes
TypeScript: Un lenguaje aburrido para programadores torpes y tristes
 
Typescript tips & tricks
Typescript tips & tricksTypescript tips & tricks
Typescript tips & tricks
 
Angular 2 - Typescript
Angular 2  - TypescriptAngular 2  - Typescript
Angular 2 - Typescript
 
TypeScript: особенности разработки / Александр Майоров (Tutu.ru)
TypeScript: особенности разработки / Александр Майоров (Tutu.ru)TypeScript: особенности разработки / Александр Майоров (Tutu.ru)
TypeScript: особенности разработки / Александр Майоров (Tutu.ru)
 
Typescript + Graphql = <3
Typescript + Graphql = <3Typescript + Graphql = <3
Typescript + Graphql = <3
 

Semelhante a Typescript in 30mins

Getting Started with the TypeScript Language
Getting Started with the TypeScript LanguageGetting Started with the TypeScript Language
Getting Started with the TypeScript LanguageGil Fink
 
Scala Italy 2015 - Hands On ScalaJS
Scala Italy 2015 - Hands On ScalaJSScala Italy 2015 - Hands On ScalaJS
Scala Italy 2015 - Hands On ScalaJSAlberto Paro
 
Alberto Paro - Hands on Scala.js
Alberto Paro - Hands on Scala.jsAlberto Paro - Hands on Scala.js
Alberto Paro - Hands on Scala.jsScala Italy
 
Modern java script features
Modern java script featuresModern java script features
Modern java script featuresKunal Kursija
 
Web technologies-course 07.pptx
Web technologies-course 07.pptxWeb technologies-course 07.pptx
Web technologies-course 07.pptxStefan Oprea
 
TypeScript: Angular's Secret Weapon
TypeScript: Angular's Secret WeaponTypeScript: Angular's Secret Weapon
TypeScript: Angular's Secret WeaponLaurent Duveau
 
JSLab.Руслан Шевченко."JavaScript как платформа компиляции"
JSLab.Руслан Шевченко."JavaScript как платформа компиляции"JSLab.Руслан Шевченко."JavaScript как платформа компиляции"
JSLab.Руслан Шевченко."JavaScript как платформа компиляции"GeeksLab Odessa
 
Jslab rssh: JS as language platform
Jslab rssh:  JS as language platformJslab rssh:  JS as language platform
Jslab rssh: JS as language platformRuslan Shevchenko
 
End-to-End SPA Development using TypeScript
End-to-End SPA Development using TypeScriptEnd-to-End SPA Development using TypeScript
End-to-End SPA Development using TypeScriptGil Fink
 
TypeScript . the JavaScript developer best friend!
TypeScript . the JavaScript developer best friend!TypeScript . the JavaScript developer best friend!
TypeScript . the JavaScript developer best friend!Alessandro Giorgetti
 
Alberto Maria Angelo Paro - Isomorphic programming in Scala and WebDevelopmen...
Alberto Maria Angelo Paro - Isomorphic programming in Scala and WebDevelopmen...Alberto Maria Angelo Paro - Isomorphic programming in Scala and WebDevelopmen...
Alberto Maria Angelo Paro - Isomorphic programming in Scala and WebDevelopmen...Codemotion
 
Next-generation JavaScript - OpenSlava 2014
Next-generation JavaScript - OpenSlava 2014Next-generation JavaScript - OpenSlava 2014
Next-generation JavaScript - OpenSlava 2014Oscar Renalias
 
End to-end apps with type script
End to-end apps with type scriptEnd to-end apps with type script
End to-end apps with type scriptGil Fink
 
Building End-to-End Apps Using Typescript
Building End-to-End Apps Using TypescriptBuilding End-to-End Apps Using Typescript
Building End-to-End Apps Using TypescriptGil Fink
 
Develop realtime web with Scala and Xitrum
Develop realtime web with Scala and XitrumDevelop realtime web with Scala and Xitrum
Develop realtime web with Scala and XitrumNgoc Dao
 
Typesafe stack - Scala, Akka and Play
Typesafe stack - Scala, Akka and PlayTypesafe stack - Scala, Akka and Play
Typesafe stack - Scala, Akka and PlayLuka Zakrajšek
 
Scala's evolving ecosystem- Introduction to Scala.js
Scala's evolving ecosystem- Introduction to Scala.jsScala's evolving ecosystem- Introduction to Scala.js
Scala's evolving ecosystem- Introduction to Scala.jsKnoldus Inc.
 
Building End to-End Web Apps Using TypeScript
Building End to-End Web Apps Using TypeScriptBuilding End to-End Web Apps Using TypeScript
Building End to-End Web Apps Using TypeScriptGil Fink
 
TypeScript Introduction
TypeScript IntroductionTypeScript Introduction
TypeScript IntroductionThanh Tai
 

Semelhante a Typescript in 30mins (20)

Getting Started with the TypeScript Language
Getting Started with the TypeScript LanguageGetting Started with the TypeScript Language
Getting Started with the TypeScript Language
 
Scala Italy 2015 - Hands On ScalaJS
Scala Italy 2015 - Hands On ScalaJSScala Italy 2015 - Hands On ScalaJS
Scala Italy 2015 - Hands On ScalaJS
 
Alberto Paro - Hands on Scala.js
Alberto Paro - Hands on Scala.jsAlberto Paro - Hands on Scala.js
Alberto Paro - Hands on Scala.js
 
Modern java script features
Modern java script featuresModern java script features
Modern java script features
 
Web technologies-course 07.pptx
Web technologies-course 07.pptxWeb technologies-course 07.pptx
Web technologies-course 07.pptx
 
TypeScript: Angular's Secret Weapon
TypeScript: Angular's Secret WeaponTypeScript: Angular's Secret Weapon
TypeScript: Angular's Secret Weapon
 
JSLab.Руслан Шевченко."JavaScript как платформа компиляции"
JSLab.Руслан Шевченко."JavaScript как платформа компиляции"JSLab.Руслан Шевченко."JavaScript как платформа компиляции"
JSLab.Руслан Шевченко."JavaScript как платформа компиляции"
 
Jslab rssh: JS as language platform
Jslab rssh:  JS as language platformJslab rssh:  JS as language platform
Jslab rssh: JS as language platform
 
End-to-End SPA Development using TypeScript
End-to-End SPA Development using TypeScriptEnd-to-End SPA Development using TypeScript
End-to-End SPA Development using TypeScript
 
TypeScript . the JavaScript developer best friend!
TypeScript . the JavaScript developer best friend!TypeScript . the JavaScript developer best friend!
TypeScript . the JavaScript developer best friend!
 
Alberto Maria Angelo Paro - Isomorphic programming in Scala and WebDevelopmen...
Alberto Maria Angelo Paro - Isomorphic programming in Scala and WebDevelopmen...Alberto Maria Angelo Paro - Isomorphic programming in Scala and WebDevelopmen...
Alberto Maria Angelo Paro - Isomorphic programming in Scala and WebDevelopmen...
 
Next-generation JavaScript - OpenSlava 2014
Next-generation JavaScript - OpenSlava 2014Next-generation JavaScript - OpenSlava 2014
Next-generation JavaScript - OpenSlava 2014
 
End to-end apps with type script
End to-end apps with type scriptEnd to-end apps with type script
End to-end apps with type script
 
Building End-to-End Apps Using Typescript
Building End-to-End Apps Using TypescriptBuilding End-to-End Apps Using Typescript
Building End-to-End Apps Using Typescript
 
Develop realtime web with Scala and Xitrum
Develop realtime web with Scala and XitrumDevelop realtime web with Scala and Xitrum
Develop realtime web with Scala and Xitrum
 
Typesafe stack - Scala, Akka and Play
Typesafe stack - Scala, Akka and PlayTypesafe stack - Scala, Akka and Play
Typesafe stack - Scala, Akka and Play
 
TypeScript
TypeScriptTypeScript
TypeScript
 
Scala's evolving ecosystem- Introduction to Scala.js
Scala's evolving ecosystem- Introduction to Scala.jsScala's evolving ecosystem- Introduction to Scala.js
Scala's evolving ecosystem- Introduction to Scala.js
 
Building End to-End Web Apps Using TypeScript
Building End to-End Web Apps Using TypeScriptBuilding End to-End Web Apps Using TypeScript
Building End to-End Web Apps Using TypeScript
 
TypeScript Introduction
TypeScript IntroductionTypeScript Introduction
TypeScript Introduction
 

Mais de Udaya Kumar

Knockout JS Development - a Quick Understanding
Knockout JS Development - a Quick UnderstandingKnockout JS Development - a Quick Understanding
Knockout JS Development - a Quick UnderstandingUdaya Kumar
 
AzureML TechTalk
AzureML TechTalkAzureML TechTalk
AzureML TechTalkUdaya Kumar
 
Innovations and Innovators Prepared by Sharika Shivani U.J
Innovations and Innovators   Prepared by Sharika Shivani U.JInnovations and Innovators   Prepared by Sharika Shivani U.J
Innovations and Innovators Prepared by Sharika Shivani U.JUdaya Kumar
 
Html5-Exploring-Training Deck - OSMOSIS 10Oct - By Udayakumar Mathivanan
Html5-Exploring-Training Deck - OSMOSIS 10Oct - By Udayakumar MathivananHtml5-Exploring-Training Deck - OSMOSIS 10Oct - By Udayakumar Mathivanan
Html5-Exploring-Training Deck - OSMOSIS 10Oct - By Udayakumar MathivananUdaya Kumar
 
KnockOutjs from Scratch
KnockOutjs from ScratchKnockOutjs from Scratch
KnockOutjs from ScratchUdaya Kumar
 
BDOTNET AngularJs Directives - Uday
BDOTNET AngularJs Directives - UdayBDOTNET AngularJs Directives - Uday
BDOTNET AngularJs Directives - UdayUdaya Kumar
 
Social Reformers Of India Prepared by Sharika Shivani U.J
Social Reformers Of India   Prepared by Sharika Shivani U.JSocial Reformers Of India   Prepared by Sharika Shivani U.J
Social Reformers Of India Prepared by Sharika Shivani U.JUdaya Kumar
 
Html5 Exploring -- by Udayakumar Mathivanan
Html5 Exploring -- by Udayakumar MathivananHtml5 Exploring -- by Udayakumar Mathivanan
Html5 Exploring -- by Udayakumar MathivananUdaya Kumar
 
WPF For Beginners - Learn in 3 days
WPF For Beginners  - Learn in 3 daysWPF For Beginners  - Learn in 3 days
WPF For Beginners - Learn in 3 daysUdaya Kumar
 

Mais de Udaya Kumar (9)

Knockout JS Development - a Quick Understanding
Knockout JS Development - a Quick UnderstandingKnockout JS Development - a Quick Understanding
Knockout JS Development - a Quick Understanding
 
AzureML TechTalk
AzureML TechTalkAzureML TechTalk
AzureML TechTalk
 
Innovations and Innovators Prepared by Sharika Shivani U.J
Innovations and Innovators   Prepared by Sharika Shivani U.JInnovations and Innovators   Prepared by Sharika Shivani U.J
Innovations and Innovators Prepared by Sharika Shivani U.J
 
Html5-Exploring-Training Deck - OSMOSIS 10Oct - By Udayakumar Mathivanan
Html5-Exploring-Training Deck - OSMOSIS 10Oct - By Udayakumar MathivananHtml5-Exploring-Training Deck - OSMOSIS 10Oct - By Udayakumar Mathivanan
Html5-Exploring-Training Deck - OSMOSIS 10Oct - By Udayakumar Mathivanan
 
KnockOutjs from Scratch
KnockOutjs from ScratchKnockOutjs from Scratch
KnockOutjs from Scratch
 
BDOTNET AngularJs Directives - Uday
BDOTNET AngularJs Directives - UdayBDOTNET AngularJs Directives - Uday
BDOTNET AngularJs Directives - Uday
 
Social Reformers Of India Prepared by Sharika Shivani U.J
Social Reformers Of India   Prepared by Sharika Shivani U.JSocial Reformers Of India   Prepared by Sharika Shivani U.J
Social Reformers Of India Prepared by Sharika Shivani U.J
 
Html5 Exploring -- by Udayakumar Mathivanan
Html5 Exploring -- by Udayakumar MathivananHtml5 Exploring -- by Udayakumar Mathivanan
Html5 Exploring -- by Udayakumar Mathivanan
 
WPF For Beginners - Learn in 3 days
WPF For Beginners  - Learn in 3 daysWPF For Beginners  - Learn in 3 days
WPF For Beginners - Learn in 3 days
 

Último

Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfkalichargn70th171
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...aditisharan08
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyFrank van der Linden
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
Introduction to Decentralized Applications (dApps)
Introduction to Decentralized Applications (dApps)Introduction to Decentralized Applications (dApps)
Introduction to Decentralized Applications (dApps)Intelisync
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 

Último (20)

Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The Ugly
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
Introduction to Decentralized Applications (dApps)
Introduction to Decentralized Applications (dApps)Introduction to Decentralized Applications (dApps)
Introduction to Decentralized Applications (dApps)
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 

Typescript in 30mins

  • 1. Introduction to TypeScript Udayakumar Mathivanan Cloud Solution Architect
  • 2. Your Logo AGENDA Why TypeScript? Language introduction / live-coding TypeScript and Angular Comparison with TS alternatives Conclusion
  • 3. Your Logo WHAT'S WRONG WITH JAVASCRIPT? Dynamic typing Lack of modularity Verbose patterns (IIFE) In short: JavaScript development scales badly
  • 4. Your Logo WHAT'S GOOD ABOUT JAVASCRIPT? It's everywhere Huge amount of libraries Flexible
  • 5. Your Logo WISHLIST Scalable HTML5 clientside development Modular development Easily learnable for Java developers Non-invasive (existing libs, browser support) Long-term vision Clean JS output (exit strategy)
  • 6. Your Logo TYPESCRIPT In short: Lightweight productivity booster Superset of JavaScript Optionally typed Compiles to ES3/ES5 No special runtime 1.0 in April 2014, future ES6 alignment
  • 7. Your Logo GETTING STARTED $ npm install -g typescript $ mv mycode.js mycode.ts $ tsc mycode.ts
  • 8. OPTIONAL TYPES Type annotations > var a = 123 > a.trim() TypeError: undefined is not a function J S = 123> var a: string > a.trim() 'number'Cannot convert to 'string'. TS Type inference Types dissapear at runtime > var a = 123 > a.trim() The property not exist on 'trim' does value of type 'number'.
  • 9. Your Logo boolean number string type[]any void Object void boolean integer long short ... String char Type[] OPTIONAL TYPES
  • 10. Your Logo OPTIONAL TYPES Types are structural rather than nominal TypeScript has function types: var find: (elem: string, elems: string[]) => string = function(elem, elems) { .. }
  • 11. Your Logo INTERFACES MyInterface { signature interface // Call (param: member: number): string number optionalMember?: number myMethod(param: string): void MyInterface = ... } var instance: instance(1)
  • 12. Your Logo INTERFACES Use them to describe data returned in REST calls User) => {$.getJSON('user/123').then((user: showProfile(user.details) }
  • 13. Your Logo INTERFACES TS interfaces are open-ended: interface JQuery { appendTo(..): .. .. } interface JQuery { draggable(..): .. .. }jquery.d.t s jquery.ui.d.t s
  • 14. OPTIONAL TYPES: ENUMS enum Language { TypeScript, Java, JavaScript } Language.TypeScriptvar lang = var ts = Language[0] ts === "TypeScript" enum Language { TypeScript = 1, Java, JavaScript } var ts = Language[1]
  • 15. TYPESCRIPT CLASSES Can implement interfaces Inheritance Instance methods/members Static methods/members Single constructor Default/optional parameters ES6 class syntax similar different
  • 16. Your Logo ARROW FUNCTIONS Implicit return No braces for single expression Part of ES6 function(arg1) { return arg1.toLowerCase(); } (arg1) => arg1.toLowerCase(); Lexically-scoped this (no more 'var that = this')
  • 17. Your Logo string): void } module StorageModule { export interface Storage { store(content: var privateKey = 'storageKey'; export class LocalStorage implements Storage { store(content: string): void { localStorage.setItem(privateKey, content); } } export class DevNullStorage Storage { store(content: string): implements void { } } = new StorageModule.LocalStorage(); } var storage: StorageModule.Storage storage.store('testing'); INTERNAL MODULES
  • 18. Your Logo string): void } module StorageModule { export interface Storage { store(content: var privateKey = 'storageKey'; export class LocalStorage implements Storage { store(content: string): void { localStorage.setItem(privateKey, content); } } export class DevNullStorage Storage { store(content: string): implements void { } } = new StorageModule.LocalStorage(); } var storage: StorageModule.Storage storage.store('testing'); INTERNAL MODULES
  • 19. Your Logo INTERNAL MODULES TS internal modules are open-ended: module export class Webshop { Cart } /// <reference module Webshop path="cart.ts" /> { export class } { .. } cart.ts Catalog { .. } main.ts
  • 20. Your Logo INTERNAL MODULES TS internal modules are open-ended: module export class Webshop { Cart } /// <reference module Webshop path="cart.ts" /> { export class } { .. } cart.ts Catalog { .. } main.ts Can be hierarchical: module Webshop.Cart.Backend { ... } Combine modules: $ tsc --out main.js main.ts
  • 21. Your Logo BUILDING TYPESCRIPT $ tsc -watch main.ts grunt-typescript grunt-ts gulp-type (incremental) gulp-tsc
  • 23. Your Logo WHO USES TYPESCRIPT? (duh)
  • 24. TypeScript Copy JS code Into TS file Compile to JavaScript • TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. • TypeScript is a language for application scale JavaScript development. • Any browser. Any host. Any OS. • Open Source. ~typescriptlang.org JS JSTS
  • 25. TypeScript Key Features • Support standard JavaScript code with static typing • Zero cost: Static types completely disappear at run-time • Encapsulation though classes, modules and interfaces • Constructors, properties and functions (public, private) • Enums • Lambda and generics support • Intellisense and syntax checking • IDE support • Visual Studio • Sublime Text, Vi, Emacs • Eclipse, WebStorm • Preview Pane – Web Essentials
  • 26. Highlights Tool Features TypeScript Code • Type Annotation • Any and Primitive Type • Interface, Implementation • Class, constructor • Opt. Parameter, overloads • Event handler • Get accessor, private, static • Arrow function, lambda • Module • Typed definitions • And more… • Type Inference • Intellisense, statement comp. • Compile on Save • Preview Pane • ECMAScript version • Redirect JavaScript output • Generate declaration files
  • 27. TypeScript Versions • TypeScript 1.3 for VS older (Web Essentials) • TypeScript 1.3 for VS 2013 Update 2 • TypeScript 1.4 for VS 2013 • TypeScript 1.4 for VS 2015 CTP5 • TypeScript 2.0 (vNext)
  • 28. Your Logo CONCLUSION TypeScript allows for gradual adoption Internal modules Classes/Interfaces Some typing External modules Type defs More typing Generics Type defs -noImplicitAny
  • 29. Resources • http://www.typescriptlang.org • http://www.typescriptlang.org/Content/TypeScript%20Languag e%20Specification.pdf • http://www.typescriptlang.org/Playground • http://vswebessentials.com/download • https://github.com/borisyankov/DefinitelyTyped • https://github.com/Microsoft/TypeScript
  • 30. Angular 2: Built on TypeScript • http://blogs.msdn.com/b/typescript/archive/2015/03/05/angul ar-2-0-built-on-typescript.aspx • http://blogs.msdn.com/b/visualstudio/archive/2015/03/12/a- preview-of-angular-2-and-typescript-in-visual-studio.aspx
  • 31. Summary • Open source language that compiles into JavaScript • Code encapsulation • Maintainable code • Tooling support Application scale JavaScript development is hard TypeScript makes it easier