SlideShare a Scribd company logo
TypeScript 
coding JavaScript 
without the pain 
@Sander_Mak Luminis Technologies
INTRO 
@Sander_Mak: Senior Software Engineer at 
Author: 
Dutch 
Java 
Magazine 
blog @ branchandbound.net 
Speaker:
AGENDA 
Why TypeScript? 
Language introduction / live-coding 
TypeScript and Angular 
Comparison with TS alternatives 
Conclusion
WHAT'S WRONG WITH JAVASCRIPT? 
Dynamic typing 
Lack of modularity 
Verbose patterns (IIFE)
WHAT'S WRONG WITH JAVASCRIPT? 
Dynamic typing 
Lack of modularity 
Verbose patterns (IIFE) 
In short: JavaScript development scales badly
WHAT'S GOOD ABOUT JAVASCRIPT? 
It's everywhere 
Huge amount of libraries 
Flexible
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)
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) 
✓✓✓✓✓✓
TypeScript: coding JavaScript without the pain
2.0 licensed
2.0 licensed
TYPESCRIPT 
Superset of JavaScript 
Optionally typed 
Compiles to ES3/ES5 
No special runtime 
1.0 in April 2014, future ES6 alignment
TYPESCRIPT 
Superset of JavaScript 
Optionally typed 
Compiles to ES3/ES5 
No special runtime 
1.0 in April 2014, future ES6 alignment 
In short: Lightweight productivity booster
GETTING STARTED 
$ npm install -g typescript 
$ mv mycode.js mycode.ts 
$ tsc mycode.ts
GETTING STARTED 
$ npm install -g typescript 
$ mv mycode.js mycode.ts 
$ tsc mycode.ts 
May even find problems in existing JS!
OPTIONAL TYPES 
Type annotations 
> var a = 123 
> a.trim() 
! 
TypeError: undefined is 
not a function 
JS 
> var a: string = 123 
> a.trim() 
! 
Cannot convert 'number' 
to 'string'. 
TS 
runtime 
compile-time
OPTIONAL TYPES 
Type annotations 
> var a = 123 
> a.trim() 
! 
TypeError: undefined is 
not a function 
JS 
> var a: string = 123 
> a.trim() 
! 
Cannot convert 'number' 
to 'string'. 
TS 
Type inference 
> var a = 123 
> a.trim() 
! 
The property 'trim' does 
not exist on value of 
type 'number'. 
Types dissapear at runtime
OPTIONAL TYPES 
Object void boolean integer 
long 
short 
... 
String 
char 
Type[] 
any void boolean number string type[]
OPTIONAL TYPES 
Types are structural rather than nominal 
TypeScript has function types: 
var find: (elem: string, elems: string[]) => string = 
function(elem, elems) { 
.. 
}
OPTIONAL TYPES 
Types are structural rather than nominal 
TypeScript has function types: 
var find: (elem: string, elems: string[]) => string = 
function(elem, elems) { 
.. 
}
DEMO: OPTIONAL TYPES 
code 
Code: http://bit.ly/tscode
INTERFACES 
interface MyInterface { 
// Call signature 
(param: number): string 
member: number 
optionalMember?: number 
myMethod(param: string): void 
} 
! 
var instance: MyInterface = ... 
instance(1)
INTERFACES 
Use them to describe data returned in REST calls 
$.getJSON('user/123').then((user: User) => { 
showProfile(user.details) 
}
INTERFACES 
TS interfaces are open-ended: 
interface JQuery { 
appendTo(..): .. 
.. 
} 
interface JQuery { 
draggable(..): .. 
.. 
jquery.d.ts } jquery.ui.d.ts
OPTIONAL TYPES: ENUMS 
enum Language { TypeScript, Java, JavaScript } 
! 
var lang = Language.TypeScript 
var ts = Language[0] 
ts === "TypeScript" 
enum Language { TypeScript = 1, Java, JavaScript } 
! 
var ts = Language[1]
GOING ALL THE WAY 
Force explicit typing with noImplicitAny 
var ambiguousType; 
! 
ambiguousType = 1 
ambiguousType = "text" noimplicitany.ts 
$ tsc --noImplicitAny noimplicitany.ts
GOING ALL THE WAY 
Force explicit typing with noImplicitAny 
var ambiguousType; 
! 
ambiguousType = 1 
ambiguousType = "text" noimplicitany.ts 
$ tsc --noImplicitAny noimplicitany.ts 
error TS7005: Variable 'ambiguousType' implicitly 
has an 'any' type.
TYPESCRIPT CLASSES 
Can implement interfaces 
Inheritance 
Instance methods/members 
Static methods/members 
Single constructor 
Default/optional parameters 
ES6 class syntax 
similar 
different
DEMO: TYPESCRIPT CLASSES 
code 
Code: http://bit.ly/tscode
ARROW FUNCTIONS 
Implicit return 
No braces for single expression 
Part of ES6
ARROW FUNCTIONS 
Implicit return 
No braces for single expression 
Part of ES6 
function(arg1) { 
return arg1.toLowerCase(); 
}
ARROW FUNCTIONS 
Implicit return 
No braces for single expression 
Part of ES6 
function(arg1) { 
return arg1.toLowerCase(); 
} 
(arg1) => arg1.toLowerCase();
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')
DEMO: ARROW FUNCTIONS 
code 
Code: http://bit.ly/tscode
TYPE DEFINITIONS 
How to integrate 
existing JS code? 
Ambient declarations 
Any-type :( 
Type definitions 
lib.d.ts 
Separate compilation: 
tsc --declaration file.ts
TYPE DEFINITIONS 
DefinitelyTyped.org 
Community provided .d.ts 
files for popular JS libs 
How to integrate 
existing JS code? 
Ambient declarations 
Any-type :( 
Type definitions 
lib.d.ts 
Separate compilation: 
tsc --declaration file.ts
INTERNAL MODULES 
module StorageModule { 
export interface Storage { store(content: string): void } 
! 
var privateKey = 'storageKey'; 
export class LocalStorage implements Storage { 
store(content: string): void { 
localStorage.setItem(privateKey, content); 
} 
} 
! 
export class DevNullStorage implements Storage { 
store(content: string): void { } 
} 
} 
! 
var storage: StorageModule.Storage = new StorageModule.LocalStorage(); 
storage.store('testing');
INTERNAL MODULES 
module StorageModule { 
export interface Storage { store(content: string): void } 
! 
var privateKey = 'storageKey'; 
export class LocalStorage implements Storage { 
store(content: string): void { 
localStorage.setItem(privateKey, content); 
} 
} 
! 
export class DevNullStorage implements Storage { 
store(content: string): void { } 
} 
} 
! 
var storage: StorageModule.Storage = new StorageModule.LocalStorage(); 
storage.store('testing');
INTERNAL MODULES 
module StorageModule { 
export interface Storage { store(content: string): void } 
! 
var privateKey = 'storageKey'; 
export class LocalStorage implements Storage { 
store(content: string): void { 
localStorage.setItem(privateKey, content); 
} 
} 
! 
export class DevNullStorage implements Storage { 
store(content: string): void { } 
} 
} 
! 
var storage: StorageModule.Storage = new StorageModule.LocalStorage(); 
storage.store('testing');
INTERNAL MODULES 
module StorageModule { 
export interface Storage { store(content: string): void } 
! 
var privateKey = 'storageKey'; 
export class LocalStorage implements Storage { 
store(content: string): void { 
localStorage.setItem(privateKey, content); 
} 
} 
! 
export class DevNullStorage implements Storage { 
store(content: string): void { } 
} 
} 
! 
var storage: StorageModule.Storage = new StorageModule.LocalStorage(); 
storage.store('testing');
INTERNAL MODULES 
TS internal modules are open-ended: 
! 
module Webshop { 
export class Cart { .. } 
} 
/// <reference path="cart.ts" /> 
module Webshop { 
export class Catalog { .. } 
cart.ts } main.ts
INTERNAL MODULES 
TS internal modules are open-ended: 
! 
module Webshop { 
export class Cart { .. } 
} 
/// <reference path="cart.ts" /> 
module Webshop { 
export class Catalog { .. } 
cart.ts } main.ts 
Can be hierarchical: 
module Webshop.Cart.Backend { 
... 
}
INTERNAL MODULES 
TS internal modules are open-ended: 
! 
module Webshop { 
export class Cart { .. } 
} 
/// <reference path="cart.ts" /> 
module Webshop { 
export class Catalog { .. } 
cart.ts } main.ts 
Can be hierarchical: 
module Webshop.Cart.Backend { 
... 
} 
Combine modules: 
$ tsc --out main.js main.ts
DEMO: PUTTING IT ALL TOGETHER 
code 
Code: http://bit.ly/tscode
EXTERNAL MODULES 
CommonJS 
Asynchronous 
Module 
Definitions 
$ tsc --module common main.ts 
$ tsc --module amd main.ts 
Combine with module loader
EXTERNAL MODULES 
'Standards-based', use existing external modules 
Automatic dependency management 
Lazy loading 
AMD verbose without TypeScript 
Currently not ES6-compatible
DEMO 
+ + 
=
DEMO: TYPESCRIPT AND ANGULAR 
code 
Code: http://bit.ly/tscode
BUILDING TYPESCRIPT 
$ tsc -watch main.ts 
grunt-typescript 
grunt-ts 
gulp-type (incremental) 
gulp-tsc
TOOLING 
IntelliJ IDEA 
WebStorm 
plugin
TYPESCRIPT vs ES6 HARMONY 
Complete language + runtime overhaul 
More features: generators, comprehensions, 
object literals 
Will take years before widely deployed 
No typing (possible ES7)
TYPESCRIPT vs COFFEESCRIPT 
Also a compile-to-JS language 
More syntactic sugar, still dynamically typed 
JS is not valid CoffeeScript 
No spec, definitely no Anders Hejlsberg... 
Future: CS doesn't track ECMAScript 6 
!
TYPESCRIPT vs DART 
Dart VM + stdlib (also compile-to-JS) 
Optionally typed 
Completely different syntax & semantics than JS 
JS interop through dart:js library 
ECMA Dart spec
TYPESCRIPT vs CLOSURE COMPILER 
Google Closure Compiler 
Pure JS 
Types in JsDoc comments 
Less expressive 
Focus on optimization, dead-code removal
WHO USES TYPESCRIPT? 
(duh)
CONCLUSION 
Internal modules 
Classes/Interfaces 
Some typing 
External modules 
Type defs 
More typing 
Generics 
Type defs 
-noImplicitAny
CONCLUSION 
TypeScript allows for gradual adoption 
Internal modules 
Classes/Interfaces 
Some typing 
External modules 
Type defs 
More typing 
Generics 
Type defs 
-noImplicitAny
CONCLUSION 
Some downsides: 
Still need to know some JS quirks 
Current compiler slowish (faster one in the works) 
External module syntax not ES6-compatible (yet) 
Non-MS tooling lagging a bit
CONCLUSION 
High value, low cost improvement over JavaScript 
Safer and more modular 
Solid path to ES6
MORE TALKS 
TypeScript: 
Wednesday, 11:30 AM, same room 
!Akka & Event-sourcing 
Wednesday, 8:30 AM, same room 
@Sander_Mak 
Luminis Technologies
RESOURCES 
Code: http://bit.ly/tscode 
! 
Learn: www.typescriptlang.org/Handbook 
@Sander_Mak 
Luminis Technologies
Ad

More Related Content

What's hot (20)

TypeScript Introduction
TypeScript IntroductionTypeScript Introduction
TypeScript Introduction
Dmitry Sheiko
 
TypeScript Overview
TypeScript OverviewTypeScript Overview
TypeScript Overview
Aniruddha Chakrabarti
 
Introducing type script
Introducing type scriptIntroducing type script
Introducing type script
Remo Jansen
 
TypeScript Presentation
TypeScript PresentationTypeScript Presentation
TypeScript Presentation
Patrick John Pacaña
 
TypeScript - An Introduction
TypeScript - An IntroductionTypeScript - An Introduction
TypeScript - An Introduction
NexThoughts Technologies
 
Typescript in 30mins
Typescript in 30mins Typescript in 30mins
Typescript in 30mins
Udaya Kumar
 
Why TypeScript?
Why TypeScript?Why TypeScript?
Why TypeScript?
FITC
 
Typescript Fundamentals
Typescript FundamentalsTypescript Fundamentals
Typescript Fundamentals
Sunny Sharma
 
Typescript ppt
Typescript pptTypescript ppt
Typescript ppt
akhilsreyas
 
Getting started with typescript
Getting started with typescriptGetting started with typescript
Getting started with typescript
C...L, NESPRESSO, WAFAASSURANCE, SOFRECOM ORANGE
 
Workshop 21: React Router
Workshop 21: React RouterWorkshop 21: React Router
Workshop 21: React Router
Visual Engineering
 
Typescript: Beginner to Advanced
Typescript: Beginner to AdvancedTypescript: Beginner to Advanced
Typescript: Beginner to Advanced
Talentica Software
 
Type script - advanced usage and practices
Type script  - advanced usage and practicesType script  - advanced usage and practices
Type script - advanced usage and practices
Iwan van der Kleijn
 
Express JS
Express JSExpress JS
Express JS
Alok Guha
 
TypeScript intro
TypeScript introTypeScript intro
TypeScript intro
Ats Uiboupin
 
Modern JS with ES6
Modern JS with ES6Modern JS with ES6
Modern JS with ES6
Kevin Langley Jr.
 
React JS
React JSReact JS
React JS
Software Infrastructure
 
Micro frontend
Micro frontendMicro frontend
Micro frontend
Amr Abd El Latief
 
Node.js Express
Node.js  ExpressNode.js  Express
Node.js Express
Eyal Vardi
 
React hooks
React hooksReact hooks
React hooks
Assaf Gannon
 

Viewers also liked (17)

Typescript + Graphql = <3
Typescript + Graphql = <3Typescript + Graphql = <3
Typescript + Graphql = <3
felixbillon
 
TypeScript: ĐŸŃĐŸĐ±Đ”ĐœĐœĐŸŃŃ‚Đž Ń€Đ°Đ·Ń€Đ°Đ±ĐŸŃ‚ĐșĐž / АлДĐșŃĐ°ĐœĐŽŃ€ МаĐčĐŸŃ€ĐŸĐČ (Tutu.ru)
TypeScript: ĐŸŃĐŸĐ±Đ”ĐœĐœĐŸŃŃ‚Đž Ń€Đ°Đ·Ń€Đ°Đ±ĐŸŃ‚ĐșĐž / АлДĐșŃĐ°ĐœĐŽŃ€ МаĐčĐŸŃ€ĐŸĐČ (Tutu.ru)TypeScript: ĐŸŃĐŸĐ±Đ”ĐœĐœĐŸŃŃ‚Đž Ń€Đ°Đ·Ń€Đ°Đ±ĐŸŃ‚ĐșĐž / АлДĐșŃĐ°ĐœĐŽŃ€ МаĐčĐŸŃ€ĐŸĐČ (Tutu.ru)
TypeScript: ĐŸŃĐŸĐ±Đ”ĐœĐœĐŸŃŃ‚Đž Ń€Đ°Đ·Ń€Đ°Đ±ĐŸŃ‚ĐșĐž / АлДĐșŃĐ°ĐœĐŽŃ€ МаĐčĐŸŃ€ĐŸĐČ (Tutu.ru)
Ontico
 
Typescript tips & tricks
Typescript tips & tricksTypescript tips & tricks
Typescript tips & tricks
Ori Calvo
 
Power Leveling your TypeScript
Power Leveling your TypeScriptPower Leveling your TypeScript
Power Leveling your TypeScript
Offirmo
 
TypeScript Seminar
TypeScript SeminarTypeScript Seminar
TypeScript Seminar
Haim Michael
 
TypeScript
TypeScriptTypeScript
TypeScript
GetDev.NET
 
Angular 2 - Typescript
Angular 2  - TypescriptAngular 2  - Typescript
Angular 2 - Typescript
Nathan Krasney
 
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
Micael Gallego
 
АлДĐșŃĐ°ĐœĐŽŃ€ РусаĐșĐŸĐČ - TypeScript 2 in action
АлДĐșŃĐ°ĐœĐŽŃ€ РусаĐșĐŸĐČ - TypeScript 2 in actionАлДĐșŃĐ°ĐœĐŽŃ€ РусаĐșĐŸĐČ - TypeScript 2 in action
АлДĐșŃĐ°ĐœĐŽŃ€ РусаĐșĐŸĐČ - TypeScript 2 in action
MoscowJS
 
TypeScript for Java Developers
TypeScript for Java DevelopersTypeScript for Java Developers
TypeScript for Java Developers
Yakov Fain
 
Typescript
TypescriptTypescript
Typescript
Nikhil Thomas
 
TypeScript
TypeScriptTypeScript
TypeScript
Udaiappa Ramachandran
 
002. Introducere in type script
002. Introducere in type script002. Introducere in type script
002. Introducere in type script
Dmitrii Stoian
 
«Typescript: ĐșĐŸĐŒŃƒ ĐœŃƒĐ¶ĐœĐ° ŃŃ‚Ń€ĐŸĐłĐ°Ń Ń‚ĐžĐżĐžĐ·Đ°Ń†ĐžŃ?», Đ“Ń€ĐžĐłĐŸŃ€ĐžĐč ĐŸĐ”Ń‚Ń€ĐŸĐČ, MoscowJS 21
«Typescript: ĐșĐŸĐŒŃƒ ĐœŃƒĐ¶ĐœĐ° ŃŃ‚Ń€ĐŸĐłĐ°Ń Ń‚ĐžĐżĐžĐ·Đ°Ń†ĐžŃ?», Đ“Ń€ĐžĐłĐŸŃ€ĐžĐč ĐŸĐ”Ń‚Ń€ĐŸĐČ, MoscowJS 21«Typescript: ĐșĐŸĐŒŃƒ ĐœŃƒĐ¶ĐœĐ° ŃŃ‚Ń€ĐŸĐłĐ°Ń Ń‚ĐžĐżĐžĐ·Đ°Ń†ĐžŃ?», Đ“Ń€ĐžĐłĐŸŃ€ĐžĐč ĐŸĐ”Ń‚Ń€ĐŸĐČ, MoscowJS 21
«Typescript: ĐșĐŸĐŒŃƒ ĐœŃƒĐ¶ĐœĐ° ŃŃ‚Ń€ĐŸĐłĐ°Ń Ń‚ĐžĐżĐžĐ·Đ°Ń†ĐžŃ?», Đ“Ń€ĐžĐłĐŸŃ€ĐžĐč ĐŸĐ”Ń‚Ń€ĐŸĐČ, MoscowJS 21
MoscowJS
 
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
Rutenis Turcinas
 
TypeScript: Angular's Secret Weapon
TypeScript: Angular's Secret WeaponTypeScript: Angular's Secret Weapon
TypeScript: Angular's Secret Weapon
Laurent Duveau
 
TypeScriptで濫適javascript
TypeScriptで濫適javascriptTypeScriptで濫適javascript
TypeScriptで濫適javascript
AfiruPain NaokiSoga
 
Typescript + Graphql = <3
Typescript + Graphql = <3Typescript + Graphql = <3
Typescript + Graphql = <3
felixbillon
 
TypeScript: ĐŸŃĐŸĐ±Đ”ĐœĐœĐŸŃŃ‚Đž Ń€Đ°Đ·Ń€Đ°Đ±ĐŸŃ‚ĐșĐž / АлДĐșŃĐ°ĐœĐŽŃ€ МаĐčĐŸŃ€ĐŸĐČ (Tutu.ru)
TypeScript: ĐŸŃĐŸĐ±Đ”ĐœĐœĐŸŃŃ‚Đž Ń€Đ°Đ·Ń€Đ°Đ±ĐŸŃ‚ĐșĐž / АлДĐșŃĐ°ĐœĐŽŃ€ МаĐčĐŸŃ€ĐŸĐČ (Tutu.ru)TypeScript: ĐŸŃĐŸĐ±Đ”ĐœĐœĐŸŃŃ‚Đž Ń€Đ°Đ·Ń€Đ°Đ±ĐŸŃ‚ĐșĐž / АлДĐșŃĐ°ĐœĐŽŃ€ МаĐčĐŸŃ€ĐŸĐČ (Tutu.ru)
TypeScript: ĐŸŃĐŸĐ±Đ”ĐœĐœĐŸŃŃ‚Đž Ń€Đ°Đ·Ń€Đ°Đ±ĐŸŃ‚ĐșĐž / АлДĐșŃĐ°ĐœĐŽŃ€ МаĐčĐŸŃ€ĐŸĐČ (Tutu.ru)
Ontico
 
Typescript tips & tricks
Typescript tips & tricksTypescript tips & tricks
Typescript tips & tricks
Ori Calvo
 
Power Leveling your TypeScript
Power Leveling your TypeScriptPower Leveling your TypeScript
Power Leveling your TypeScript
Offirmo
 
TypeScript Seminar
TypeScript SeminarTypeScript Seminar
TypeScript Seminar
Haim Michael
 
TypeScript
TypeScriptTypeScript
TypeScript
GetDev.NET
 
Angular 2 - Typescript
Angular 2  - TypescriptAngular 2  - Typescript
Angular 2 - Typescript
Nathan Krasney
 
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
Micael Gallego
 
АлДĐșŃĐ°ĐœĐŽŃ€ РусаĐșĐŸĐČ - TypeScript 2 in action
АлДĐșŃĐ°ĐœĐŽŃ€ РусаĐșĐŸĐČ - TypeScript 2 in actionАлДĐșŃĐ°ĐœĐŽŃ€ РусаĐșĐŸĐČ - TypeScript 2 in action
АлДĐșŃĐ°ĐœĐŽŃ€ РусаĐșĐŸĐČ - TypeScript 2 in action
MoscowJS
 
TypeScript for Java Developers
TypeScript for Java DevelopersTypeScript for Java Developers
TypeScript for Java Developers
Yakov Fain
 
002. Introducere in type script
002. Introducere in type script002. Introducere in type script
002. Introducere in type script
Dmitrii Stoian
 
«Typescript: ĐșĐŸĐŒŃƒ ĐœŃƒĐ¶ĐœĐ° ŃŃ‚Ń€ĐŸĐłĐ°Ń Ń‚ĐžĐżĐžĐ·Đ°Ń†ĐžŃ?», Đ“Ń€ĐžĐłĐŸŃ€ĐžĐč ĐŸĐ”Ń‚Ń€ĐŸĐČ, MoscowJS 21
«Typescript: ĐșĐŸĐŒŃƒ ĐœŃƒĐ¶ĐœĐ° ŃŃ‚Ń€ĐŸĐłĐ°Ń Ń‚ĐžĐżĐžĐ·Đ°Ń†ĐžŃ?», Đ“Ń€ĐžĐłĐŸŃ€ĐžĐč ĐŸĐ”Ń‚Ń€ĐŸĐČ, MoscowJS 21«Typescript: ĐșĐŸĐŒŃƒ ĐœŃƒĐ¶ĐœĐ° ŃŃ‚Ń€ĐŸĐłĐ°Ń Ń‚ĐžĐżĐžĐ·Đ°Ń†ĐžŃ?», Đ“Ń€ĐžĐłĐŸŃ€ĐžĐč ĐŸĐ”Ń‚Ń€ĐŸĐČ, MoscowJS 21
«Typescript: ĐșĐŸĐŒŃƒ ĐœŃƒĐ¶ĐœĐ° ŃŃ‚Ń€ĐŸĐłĐ°Ń Ń‚ĐžĐżĐžĐ·Đ°Ń†ĐžŃ?», Đ“Ń€ĐžĐłĐŸŃ€ĐžĐč ĐŸĐ”Ń‚Ń€ĐŸĐČ, MoscowJS 21
MoscowJS
 
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
Rutenis Turcinas
 
TypeScript: Angular's Secret Weapon
TypeScript: Angular's Secret WeaponTypeScript: Angular's Secret Weapon
TypeScript: Angular's Secret Weapon
Laurent Duveau
 
TypeScriptで濫適javascript
TypeScriptで濫適javascriptTypeScriptで濫適javascript
TypeScriptで濫適javascript
AfiruPain NaokiSoga
 
Ad

Similar to TypeScript: coding JavaScript without the pain (20)

TypeScript: Angular's Secret Weapon
TypeScript: Angular's Secret WeaponTypeScript: Angular's Secret Weapon
TypeScript: Angular's Secret Weapon
Laurent Duveau
 
The advantage of developing with TypeScript
The advantage of developing with TypeScript The advantage of developing with TypeScript
The advantage of developing with TypeScript
Corley S.r.l.
 
AngularConf2015
AngularConf2015AngularConf2015
AngularConf2015
Alessandro Giorgetti
 
Web technologies-course 07.pptx
Web technologies-course 07.pptxWeb technologies-course 07.pptx
Web technologies-course 07.pptx
Stefan Oprea
 
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
 
Crystal internals (part 1)
Crystal internals (part 1)Crystal internals (part 1)
Crystal internals (part 1)
Ary Borenszweig
 
Crystal internals (part 1)
Crystal internals (part 1)Crystal internals (part 1)
Crystal internals (part 1)
Ary Borenszweig
 
Crystal internals (part 1)
Crystal internals (part 1)Crystal internals (part 1)
Crystal internals (part 1)
Crystal Language
 
Type script
Type scriptType script
Type script
srinivaskapa1
 
Milot Shala - C++ (OSCAL2014)
Milot Shala - C++ (OSCAL2014)Milot Shala - C++ (OSCAL2014)
Milot Shala - C++ (OSCAL2014)
Open Labs Albania
 
What's coming to c# (Tel-Aviv, 2018)
What's coming to c# (Tel-Aviv, 2018)What's coming to c# (Tel-Aviv, 2018)
What's coming to c# (Tel-Aviv, 2018)
Moaid Hathot
 
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
Malla Reddy University
 
TypeScript: Basic Features and Compilation Guide
TypeScript: Basic Features and Compilation GuideTypeScript: Basic Features and Compilation Guide
TypeScript: Basic Features and Compilation Guide
Nascenia IT
 
Getting started with typescript and angular 2
Getting started with typescript  and angular 2Getting started with typescript  and angular 2
Getting started with typescript and angular 2
Knoldus Inc.
 
Typescript language extension of java script
Typescript language extension of java scriptTypescript language extension of java script
Typescript language extension of java script
michaelaaron25322
 
[Td 2015] what is new in visual c++ 2015 and future directions(ulzii luvsanba...
[Td 2015] what is new in visual c++ 2015 and future directions(ulzii luvsanba...[Td 2015] what is new in visual c++ 2015 and future directions(ulzii luvsanba...
[Td 2015] what is new in visual c++ 2015 and future directions(ulzii luvsanba...
Sang Don Kim
 
Powerpoint about JavaScript presentation
Powerpoint about JavaScript presentationPowerpoint about JavaScript presentation
Powerpoint about JavaScript presentation
XaiMaeChanelleSopsop
 
Ingo Muschenetz: Titanium Studio Deep Dive
Ingo Muschenetz: Titanium Studio Deep DiveIngo Muschenetz: Titanium Studio Deep Dive
Ingo Muschenetz: Titanium Studio Deep Dive
Axway Appcelerator
 
Complete Notes on Angular 2 and TypeScript
Complete Notes on Angular 2 and TypeScriptComplete Notes on Angular 2 and TypeScript
Complete Notes on Angular 2 and TypeScript
EPAM Systems
 
MongoDB World 2019: BSON Transpilers: Transpiling from Any Language to Any La...
MongoDB World 2019: BSON Transpilers: Transpiling from Any Language to Any La...MongoDB World 2019: BSON Transpilers: Transpiling from Any Language to Any La...
MongoDB World 2019: BSON Transpilers: Transpiling from Any Language to Any La...
MongoDB
 
TypeScript: Angular's Secret Weapon
TypeScript: Angular's Secret WeaponTypeScript: Angular's Secret Weapon
TypeScript: Angular's Secret Weapon
Laurent Duveau
 
The advantage of developing with TypeScript
The advantage of developing with TypeScript The advantage of developing with TypeScript
The advantage of developing with TypeScript
Corley S.r.l.
 
Web technologies-course 07.pptx
Web technologies-course 07.pptxWeb technologies-course 07.pptx
Web technologies-course 07.pptx
Stefan Oprea
 
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
 
Crystal internals (part 1)
Crystal internals (part 1)Crystal internals (part 1)
Crystal internals (part 1)
Ary Borenszweig
 
Crystal internals (part 1)
Crystal internals (part 1)Crystal internals (part 1)
Crystal internals (part 1)
Ary Borenszweig
 
Crystal internals (part 1)
Crystal internals (part 1)Crystal internals (part 1)
Crystal internals (part 1)
Crystal Language
 
Milot Shala - C++ (OSCAL2014)
Milot Shala - C++ (OSCAL2014)Milot Shala - C++ (OSCAL2014)
Milot Shala - C++ (OSCAL2014)
Open Labs Albania
 
What's coming to c# (Tel-Aviv, 2018)
What's coming to c# (Tel-Aviv, 2018)What's coming to c# (Tel-Aviv, 2018)
What's coming to c# (Tel-Aviv, 2018)
Moaid Hathot
 
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
Malla Reddy University
 
TypeScript: Basic Features and Compilation Guide
TypeScript: Basic Features and Compilation GuideTypeScript: Basic Features and Compilation Guide
TypeScript: Basic Features and Compilation Guide
Nascenia IT
 
Getting started with typescript and angular 2
Getting started with typescript  and angular 2Getting started with typescript  and angular 2
Getting started with typescript and angular 2
Knoldus Inc.
 
Typescript language extension of java script
Typescript language extension of java scriptTypescript language extension of java script
Typescript language extension of java script
michaelaaron25322
 
[Td 2015] what is new in visual c++ 2015 and future directions(ulzii luvsanba...
[Td 2015] what is new in visual c++ 2015 and future directions(ulzii luvsanba...[Td 2015] what is new in visual c++ 2015 and future directions(ulzii luvsanba...
[Td 2015] what is new in visual c++ 2015 and future directions(ulzii luvsanba...
Sang Don Kim
 
Powerpoint about JavaScript presentation
Powerpoint about JavaScript presentationPowerpoint about JavaScript presentation
Powerpoint about JavaScript presentation
XaiMaeChanelleSopsop
 
Ingo Muschenetz: Titanium Studio Deep Dive
Ingo Muschenetz: Titanium Studio Deep DiveIngo Muschenetz: Titanium Studio Deep Dive
Ingo Muschenetz: Titanium Studio Deep Dive
Axway Appcelerator
 
Complete Notes on Angular 2 and TypeScript
Complete Notes on Angular 2 and TypeScriptComplete Notes on Angular 2 and TypeScript
Complete Notes on Angular 2 and TypeScript
EPAM Systems
 
MongoDB World 2019: BSON Transpilers: Transpiling from Any Language to Any La...
MongoDB World 2019: BSON Transpilers: Transpiling from Any Language to Any La...MongoDB World 2019: BSON Transpilers: Transpiling from Any Language to Any La...
MongoDB World 2019: BSON Transpilers: Transpiling from Any Language to Any La...
MongoDB
 
Ad

More from Sander Mak (@Sander_Mak) (20)

Scalable Application Development @ Picnic
Scalable Application Development @ PicnicScalable Application Development @ Picnic
Scalable Application Development @ Picnic
Sander Mak (@Sander_Mak)
 
Coding Your Way to Java 13
Coding Your Way to Java 13Coding Your Way to Java 13
Coding Your Way to Java 13
Sander Mak (@Sander_Mak)
 
Coding Your Way to Java 12
Coding Your Way to Java 12Coding Your Way to Java 12
Coding Your Way to Java 12
Sander Mak (@Sander_Mak)
 
Java Modularity: the Year After
Java Modularity: the Year AfterJava Modularity: the Year After
Java Modularity: the Year After
Sander Mak (@Sander_Mak)
 
Desiging for Modularity with Java 9
Desiging for Modularity with Java 9Desiging for Modularity with Java 9
Desiging for Modularity with Java 9
Sander Mak (@Sander_Mak)
 
Modules or microservices?
Modules or microservices?Modules or microservices?
Modules or microservices?
Sander Mak (@Sander_Mak)
 
Migrating to Java 9 Modules
Migrating to Java 9 ModulesMigrating to Java 9 Modules
Migrating to Java 9 Modules
Sander Mak (@Sander_Mak)
 
Java 9 Modularity in Action
Java 9 Modularity in ActionJava 9 Modularity in Action
Java 9 Modularity in Action
Sander Mak (@Sander_Mak)
 
Java modularity: life after Java 9
Java modularity: life after Java 9Java modularity: life after Java 9
Java modularity: life after Java 9
Sander Mak (@Sander_Mak)
 
Provisioning the IoT
Provisioning the IoTProvisioning the IoT
Provisioning the IoT
Sander Mak (@Sander_Mak)
 
Event-sourced architectures with Akka
Event-sourced architectures with AkkaEvent-sourced architectures with Akka
Event-sourced architectures with Akka
Sander Mak (@Sander_Mak)
 
The Ultimate Dependency Manager Shootout (QCon NY 2014)
The Ultimate Dependency Manager Shootout (QCon NY 2014)The Ultimate Dependency Manager Shootout (QCon NY 2014)
The Ultimate Dependency Manager Shootout (QCon NY 2014)
Sander Mak (@Sander_Mak)
 
Modular JavaScript
Modular JavaScriptModular JavaScript
Modular JavaScript
Sander Mak (@Sander_Mak)
 
Modularity in the Cloud
Modularity in the CloudModularity in the Cloud
Modularity in the Cloud
Sander Mak (@Sander_Mak)
 
Cross-Build Injection attacks: how safe is your Java build?
Cross-Build Injection attacks: how safe is your Java build?Cross-Build Injection attacks: how safe is your Java build?
Cross-Build Injection attacks: how safe is your Java build?
Sander Mak (@Sander_Mak)
 
Scala & Lift (JEEConf 2012)
Scala & Lift (JEEConf 2012)Scala & Lift (JEEConf 2012)
Scala & Lift (JEEConf 2012)
Sander Mak (@Sander_Mak)
 
Hibernate Performance Tuning (JEEConf 2012)
Hibernate Performance Tuning (JEEConf 2012)Hibernate Performance Tuning (JEEConf 2012)
Hibernate Performance Tuning (JEEConf 2012)
Sander Mak (@Sander_Mak)
 
Akka (BeJUG)
Akka (BeJUG)Akka (BeJUG)
Akka (BeJUG)
Sander Mak (@Sander_Mak)
 
Fork Join (BeJUG 2012)
Fork Join (BeJUG 2012)Fork Join (BeJUG 2012)
Fork Join (BeJUG 2012)
Sander Mak (@Sander_Mak)
 
Fork/Join for Fun and Profit!
Fork/Join for Fun and Profit!Fork/Join for Fun and Profit!
Fork/Join for Fun and Profit!
Sander Mak (@Sander_Mak)
 
Scalable Application Development @ Picnic
Scalable Application Development @ PicnicScalable Application Development @ Picnic
Scalable Application Development @ Picnic
Sander Mak (@Sander_Mak)
 
Event-sourced architectures with Akka
Event-sourced architectures with AkkaEvent-sourced architectures with Akka
Event-sourced architectures with Akka
Sander Mak (@Sander_Mak)
 
The Ultimate Dependency Manager Shootout (QCon NY 2014)
The Ultimate Dependency Manager Shootout (QCon NY 2014)The Ultimate Dependency Manager Shootout (QCon NY 2014)
The Ultimate Dependency Manager Shootout (QCon NY 2014)
Sander Mak (@Sander_Mak)
 
Cross-Build Injection attacks: how safe is your Java build?
Cross-Build Injection attacks: how safe is your Java build?Cross-Build Injection attacks: how safe is your Java build?
Cross-Build Injection attacks: how safe is your Java build?
Sander Mak (@Sander_Mak)
 
Hibernate Performance Tuning (JEEConf 2012)
Hibernate Performance Tuning (JEEConf 2012)Hibernate Performance Tuning (JEEConf 2012)
Hibernate Performance Tuning (JEEConf 2012)
Sander Mak (@Sander_Mak)
 

Recently uploaded (20)

Download MathType Crack Version 2025???
Download MathType Crack  Version 2025???Download MathType Crack  Version 2025???
Download MathType Crack Version 2025???
Google
 
Reinventing Microservices Efficiency and Innovation with Single-Runtime
Reinventing Microservices Efficiency and Innovation with Single-RuntimeReinventing Microservices Efficiency and Innovation with Single-Runtime
Reinventing Microservices Efficiency and Innovation with Single-Runtime
Natan Silnitsky
 
How I solved production issues with OpenTelemetry
How I solved production issues with OpenTelemetryHow I solved production issues with OpenTelemetry
How I solved production issues with OpenTelemetry
Cees Bos
 
Robotic Process Automation (RPA) Software Development Services.pptx
Robotic Process Automation (RPA) Software Development Services.pptxRobotic Process Automation (RPA) Software Development Services.pptx
Robotic Process Automation (RPA) Software Development Services.pptx
julia smits
 
Unit Two - Java Architecture and OOPS
Unit Two  -   Java Architecture and OOPSUnit Two  -   Java Architecture and OOPS
Unit Two - Java Architecture and OOPS
Nabin Dhakal
 
GC Tuning: A Masterpiece in Performance Engineering
GC Tuning: A Masterpiece in Performance EngineeringGC Tuning: A Masterpiece in Performance Engineering
GC Tuning: A Masterpiece in Performance Engineering
Tier1 app
 
Beyond the code. Complexity - 2025.05 - SwiftCraft
Beyond the code. Complexity - 2025.05 - SwiftCraftBeyond the code. Complexity - 2025.05 - SwiftCraft
Beyond the code. Complexity - 2025.05 - SwiftCraft
Dmitrii Ivanov
 
Do not let staffing shortages and limited fiscal view hamper your cause
Do not let staffing shortages and limited fiscal view hamper your causeDo not let staffing shortages and limited fiscal view hamper your cause
Do not let staffing shortages and limited fiscal view hamper your cause
Fexle Services Pvt. Ltd.
 
Codingo Ltd. - Introduction - Mobile application, web, custom software develo...
Codingo Ltd. - Introduction - Mobile application, web, custom software develo...Codingo Ltd. - Introduction - Mobile application, web, custom software develo...
Codingo Ltd. - Introduction - Mobile application, web, custom software develo...
Codingo
 
Serato DJ Pro Crack Latest Version 2025??
Serato DJ Pro Crack Latest Version 2025??Serato DJ Pro Crack Latest Version 2025??
Serato DJ Pro Crack Latest Version 2025??
Web Designer
 
Time Estimation: Expert Tips & Proven Project Techniques
Time Estimation: Expert Tips & Proven Project TechniquesTime Estimation: Expert Tips & Proven Project Techniques
Time Estimation: Expert Tips & Proven Project Techniques
Livetecs LLC
 
User interface and User experience Modernization.pptx
User interface and User experience  Modernization.pptxUser interface and User experience  Modernization.pptx
User interface and User experience Modernization.pptx
MustafaAlshekly1
 
Troubleshooting JVM Outages – 3 Fortune 500 case studies
Troubleshooting JVM Outages – 3 Fortune 500 case studiesTroubleshooting JVM Outages – 3 Fortune 500 case studies
Troubleshooting JVM Outages – 3 Fortune 500 case studies
Tier1 app
 
Programs as Values - Write code and don't get lost
Programs as Values - Write code and don't get lostPrograms as Values - Write code and don't get lost
Programs as Values - Write code and don't get lost
Pierangelo Cecchetto
 
Mobile Application Developer Dubai | Custom App Solutions by Ajath
Mobile Application Developer Dubai | Custom App Solutions by AjathMobile Application Developer Dubai | Custom App Solutions by Ajath
Mobile Application Developer Dubai | Custom App Solutions by Ajath
Ajath Infotech Technologies LLC
 
A Comprehensive Guide to CRM Software Benefits for Every Business Stage
A Comprehensive Guide to CRM Software Benefits for Every Business StageA Comprehensive Guide to CRM Software Benefits for Every Business Stage
A Comprehensive Guide to CRM Software Benefits for Every Business Stage
SynapseIndia
 
Passive House Canada Conference 2025 Presentation [Final]_v4.ppt
Passive House Canada Conference 2025 Presentation [Final]_v4.pptPassive House Canada Conference 2025 Presentation [Final]_v4.ppt
Passive House Canada Conference 2025 Presentation [Final]_v4.ppt
IES VE
 
Artificial hand using embedded system.pptx
Artificial hand using embedded system.pptxArtificial hand using embedded system.pptx
Artificial hand using embedded system.pptx
bhoomigowda12345
 
wAIred_LearnWithOutAI_JCON_14052025.pptx
wAIred_LearnWithOutAI_JCON_14052025.pptxwAIred_LearnWithOutAI_JCON_14052025.pptx
wAIred_LearnWithOutAI_JCON_14052025.pptx
SimonedeGijt
 
Deploying & Testing Agentforce - End-to-end with Copado - Ewenb Clark
Deploying & Testing Agentforce - End-to-end with Copado - Ewenb ClarkDeploying & Testing Agentforce - End-to-end with Copado - Ewenb Clark
Deploying & Testing Agentforce - End-to-end with Copado - Ewenb Clark
Peter Caitens
 
Download MathType Crack Version 2025???
Download MathType Crack  Version 2025???Download MathType Crack  Version 2025???
Download MathType Crack Version 2025???
Google
 
Reinventing Microservices Efficiency and Innovation with Single-Runtime
Reinventing Microservices Efficiency and Innovation with Single-RuntimeReinventing Microservices Efficiency and Innovation with Single-Runtime
Reinventing Microservices Efficiency and Innovation with Single-Runtime
Natan Silnitsky
 
How I solved production issues with OpenTelemetry
How I solved production issues with OpenTelemetryHow I solved production issues with OpenTelemetry
How I solved production issues with OpenTelemetry
Cees Bos
 
Robotic Process Automation (RPA) Software Development Services.pptx
Robotic Process Automation (RPA) Software Development Services.pptxRobotic Process Automation (RPA) Software Development Services.pptx
Robotic Process Automation (RPA) Software Development Services.pptx
julia smits
 
Unit Two - Java Architecture and OOPS
Unit Two  -   Java Architecture and OOPSUnit Two  -   Java Architecture and OOPS
Unit Two - Java Architecture and OOPS
Nabin Dhakal
 
GC Tuning: A Masterpiece in Performance Engineering
GC Tuning: A Masterpiece in Performance EngineeringGC Tuning: A Masterpiece in Performance Engineering
GC Tuning: A Masterpiece in Performance Engineering
Tier1 app
 
Beyond the code. Complexity - 2025.05 - SwiftCraft
Beyond the code. Complexity - 2025.05 - SwiftCraftBeyond the code. Complexity - 2025.05 - SwiftCraft
Beyond the code. Complexity - 2025.05 - SwiftCraft
Dmitrii Ivanov
 
Do not let staffing shortages and limited fiscal view hamper your cause
Do not let staffing shortages and limited fiscal view hamper your causeDo not let staffing shortages and limited fiscal view hamper your cause
Do not let staffing shortages and limited fiscal view hamper your cause
Fexle Services Pvt. Ltd.
 
Codingo Ltd. - Introduction - Mobile application, web, custom software develo...
Codingo Ltd. - Introduction - Mobile application, web, custom software develo...Codingo Ltd. - Introduction - Mobile application, web, custom software develo...
Codingo Ltd. - Introduction - Mobile application, web, custom software develo...
Codingo
 
Serato DJ Pro Crack Latest Version 2025??
Serato DJ Pro Crack Latest Version 2025??Serato DJ Pro Crack Latest Version 2025??
Serato DJ Pro Crack Latest Version 2025??
Web Designer
 
Time Estimation: Expert Tips & Proven Project Techniques
Time Estimation: Expert Tips & Proven Project TechniquesTime Estimation: Expert Tips & Proven Project Techniques
Time Estimation: Expert Tips & Proven Project Techniques
Livetecs LLC
 
User interface and User experience Modernization.pptx
User interface and User experience  Modernization.pptxUser interface and User experience  Modernization.pptx
User interface and User experience Modernization.pptx
MustafaAlshekly1
 
Troubleshooting JVM Outages – 3 Fortune 500 case studies
Troubleshooting JVM Outages – 3 Fortune 500 case studiesTroubleshooting JVM Outages – 3 Fortune 500 case studies
Troubleshooting JVM Outages – 3 Fortune 500 case studies
Tier1 app
 
Programs as Values - Write code and don't get lost
Programs as Values - Write code and don't get lostPrograms as Values - Write code and don't get lost
Programs as Values - Write code and don't get lost
Pierangelo Cecchetto
 
Mobile Application Developer Dubai | Custom App Solutions by Ajath
Mobile Application Developer Dubai | Custom App Solutions by AjathMobile Application Developer Dubai | Custom App Solutions by Ajath
Mobile Application Developer Dubai | Custom App Solutions by Ajath
Ajath Infotech Technologies LLC
 
A Comprehensive Guide to CRM Software Benefits for Every Business Stage
A Comprehensive Guide to CRM Software Benefits for Every Business StageA Comprehensive Guide to CRM Software Benefits for Every Business Stage
A Comprehensive Guide to CRM Software Benefits for Every Business Stage
SynapseIndia
 
Passive House Canada Conference 2025 Presentation [Final]_v4.ppt
Passive House Canada Conference 2025 Presentation [Final]_v4.pptPassive House Canada Conference 2025 Presentation [Final]_v4.ppt
Passive House Canada Conference 2025 Presentation [Final]_v4.ppt
IES VE
 
Artificial hand using embedded system.pptx
Artificial hand using embedded system.pptxArtificial hand using embedded system.pptx
Artificial hand using embedded system.pptx
bhoomigowda12345
 
wAIred_LearnWithOutAI_JCON_14052025.pptx
wAIred_LearnWithOutAI_JCON_14052025.pptxwAIred_LearnWithOutAI_JCON_14052025.pptx
wAIred_LearnWithOutAI_JCON_14052025.pptx
SimonedeGijt
 
Deploying & Testing Agentforce - End-to-end with Copado - Ewenb Clark
Deploying & Testing Agentforce - End-to-end with Copado - Ewenb ClarkDeploying & Testing Agentforce - End-to-end with Copado - Ewenb Clark
Deploying & Testing Agentforce - End-to-end with Copado - Ewenb Clark
Peter Caitens
 

TypeScript: coding JavaScript without the pain

  • 1. TypeScript coding JavaScript without the pain @Sander_Mak Luminis Technologies
  • 2. INTRO @Sander_Mak: Senior Software Engineer at Author: Dutch Java Magazine blog @ branchandbound.net Speaker:
  • 3. AGENDA Why TypeScript? Language introduction / live-coding TypeScript and Angular Comparison with TS alternatives Conclusion
  • 4. WHAT'S WRONG WITH JAVASCRIPT? Dynamic typing Lack of modularity Verbose patterns (IIFE)
  • 5. WHAT'S WRONG WITH JAVASCRIPT? Dynamic typing Lack of modularity Verbose patterns (IIFE) In short: JavaScript development scales badly
  • 6. WHAT'S GOOD ABOUT JAVASCRIPT? It's everywhere Huge amount of libraries Flexible
  • 7. 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)
  • 8. 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) ✓✓✓✓✓✓
  • 12. TYPESCRIPT Superset of JavaScript Optionally typed Compiles to ES3/ES5 No special runtime 1.0 in April 2014, future ES6 alignment
  • 13. TYPESCRIPT Superset of JavaScript Optionally typed Compiles to ES3/ES5 No special runtime 1.0 in April 2014, future ES6 alignment In short: Lightweight productivity booster
  • 14. GETTING STARTED $ npm install -g typescript $ mv mycode.js mycode.ts $ tsc mycode.ts
  • 15. GETTING STARTED $ npm install -g typescript $ mv mycode.js mycode.ts $ tsc mycode.ts May even find problems in existing JS!
  • 16. OPTIONAL TYPES Type annotations > var a = 123 > a.trim() ! TypeError: undefined is not a function JS > var a: string = 123 > a.trim() ! Cannot convert 'number' to 'string'. TS runtime compile-time
  • 17. OPTIONAL TYPES Type annotations > var a = 123 > a.trim() ! TypeError: undefined is not a function JS > var a: string = 123 > a.trim() ! Cannot convert 'number' to 'string'. TS Type inference > var a = 123 > a.trim() ! The property 'trim' does not exist on value of type 'number'. Types dissapear at runtime
  • 18. OPTIONAL TYPES Object void boolean integer long short ... String char Type[] any void boolean number string type[]
  • 19. OPTIONAL TYPES Types are structural rather than nominal TypeScript has function types: var find: (elem: string, elems: string[]) => string = function(elem, elems) { .. }
  • 20. OPTIONAL TYPES Types are structural rather than nominal TypeScript has function types: var find: (elem: string, elems: string[]) => string = function(elem, elems) { .. }
  • 21. DEMO: OPTIONAL TYPES code Code: http://bit.ly/tscode
  • 22. INTERFACES interface MyInterface { // Call signature (param: number): string member: number optionalMember?: number myMethod(param: string): void } ! var instance: MyInterface = ... instance(1)
  • 23. INTERFACES Use them to describe data returned in REST calls $.getJSON('user/123').then((user: User) => { showProfile(user.details) }
  • 24. INTERFACES TS interfaces are open-ended: interface JQuery { appendTo(..): .. .. } interface JQuery { draggable(..): .. .. jquery.d.ts } jquery.ui.d.ts
  • 25. OPTIONAL TYPES: ENUMS enum Language { TypeScript, Java, JavaScript } ! var lang = Language.TypeScript var ts = Language[0] ts === "TypeScript" enum Language { TypeScript = 1, Java, JavaScript } ! var ts = Language[1]
  • 26. GOING ALL THE WAY Force explicit typing with noImplicitAny var ambiguousType; ! ambiguousType = 1 ambiguousType = "text" noimplicitany.ts $ tsc --noImplicitAny noimplicitany.ts
  • 27. GOING ALL THE WAY Force explicit typing with noImplicitAny var ambiguousType; ! ambiguousType = 1 ambiguousType = "text" noimplicitany.ts $ tsc --noImplicitAny noimplicitany.ts error TS7005: Variable 'ambiguousType' implicitly has an 'any' type.
  • 28. TYPESCRIPT CLASSES Can implement interfaces Inheritance Instance methods/members Static methods/members Single constructor Default/optional parameters ES6 class syntax similar different
  • 29. DEMO: TYPESCRIPT CLASSES code Code: http://bit.ly/tscode
  • 30. ARROW FUNCTIONS Implicit return No braces for single expression Part of ES6
  • 31. ARROW FUNCTIONS Implicit return No braces for single expression Part of ES6 function(arg1) { return arg1.toLowerCase(); }
  • 32. ARROW FUNCTIONS Implicit return No braces for single expression Part of ES6 function(arg1) { return arg1.toLowerCase(); } (arg1) => arg1.toLowerCase();
  • 33. 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')
  • 34. DEMO: ARROW FUNCTIONS code Code: http://bit.ly/tscode
  • 35. TYPE DEFINITIONS How to integrate existing JS code? Ambient declarations Any-type :( Type definitions lib.d.ts Separate compilation: tsc --declaration file.ts
  • 36. TYPE DEFINITIONS DefinitelyTyped.org Community provided .d.ts files for popular JS libs How to integrate existing JS code? Ambient declarations Any-type :( Type definitions lib.d.ts Separate compilation: tsc --declaration file.ts
  • 37. INTERNAL MODULES module StorageModule { export interface Storage { store(content: string): void } ! var privateKey = 'storageKey'; export class LocalStorage implements Storage { store(content: string): void { localStorage.setItem(privateKey, content); } } ! export class DevNullStorage implements Storage { store(content: string): void { } } } ! var storage: StorageModule.Storage = new StorageModule.LocalStorage(); storage.store('testing');
  • 38. INTERNAL MODULES module StorageModule { export interface Storage { store(content: string): void } ! var privateKey = 'storageKey'; export class LocalStorage implements Storage { store(content: string): void { localStorage.setItem(privateKey, content); } } ! export class DevNullStorage implements Storage { store(content: string): void { } } } ! var storage: StorageModule.Storage = new StorageModule.LocalStorage(); storage.store('testing');
  • 39. INTERNAL MODULES module StorageModule { export interface Storage { store(content: string): void } ! var privateKey = 'storageKey'; export class LocalStorage implements Storage { store(content: string): void { localStorage.setItem(privateKey, content); } } ! export class DevNullStorage implements Storage { store(content: string): void { } } } ! var storage: StorageModule.Storage = new StorageModule.LocalStorage(); storage.store('testing');
  • 40. INTERNAL MODULES module StorageModule { export interface Storage { store(content: string): void } ! var privateKey = 'storageKey'; export class LocalStorage implements Storage { store(content: string): void { localStorage.setItem(privateKey, content); } } ! export class DevNullStorage implements Storage { store(content: string): void { } } } ! var storage: StorageModule.Storage = new StorageModule.LocalStorage(); storage.store('testing');
  • 41. INTERNAL MODULES TS internal modules are open-ended: ! module Webshop { export class Cart { .. } } /// <reference path="cart.ts" /> module Webshop { export class Catalog { .. } cart.ts } main.ts
  • 42. INTERNAL MODULES TS internal modules are open-ended: ! module Webshop { export class Cart { .. } } /// <reference path="cart.ts" /> module Webshop { export class Catalog { .. } cart.ts } main.ts Can be hierarchical: module Webshop.Cart.Backend { ... }
  • 43. INTERNAL MODULES TS internal modules are open-ended: ! module Webshop { export class Cart { .. } } /// <reference path="cart.ts" /> module Webshop { export class Catalog { .. } cart.ts } main.ts Can be hierarchical: module Webshop.Cart.Backend { ... } Combine modules: $ tsc --out main.js main.ts
  • 44. DEMO: PUTTING IT ALL TOGETHER code Code: http://bit.ly/tscode
  • 45. EXTERNAL MODULES CommonJS Asynchronous Module Definitions $ tsc --module common main.ts $ tsc --module amd main.ts Combine with module loader
  • 46. EXTERNAL MODULES 'Standards-based', use existing external modules Automatic dependency management Lazy loading AMD verbose without TypeScript Currently not ES6-compatible
  • 47. DEMO + + =
  • 48. DEMO: TYPESCRIPT AND ANGULAR code Code: http://bit.ly/tscode
  • 49. BUILDING TYPESCRIPT $ tsc -watch main.ts grunt-typescript grunt-ts gulp-type (incremental) gulp-tsc
  • 50. TOOLING IntelliJ IDEA WebStorm plugin
  • 51. TYPESCRIPT vs ES6 HARMONY Complete language + runtime overhaul More features: generators, comprehensions, object literals Will take years before widely deployed No typing (possible ES7)
  • 52. TYPESCRIPT vs COFFEESCRIPT Also a compile-to-JS language More syntactic sugar, still dynamically typed JS is not valid CoffeeScript No spec, definitely no Anders Hejlsberg... Future: CS doesn't track ECMAScript 6 !
  • 53. TYPESCRIPT vs DART Dart VM + stdlib (also compile-to-JS) Optionally typed Completely different syntax & semantics than JS JS interop through dart:js library ECMA Dart spec
  • 54. TYPESCRIPT vs CLOSURE COMPILER Google Closure Compiler Pure JS Types in JsDoc comments Less expressive Focus on optimization, dead-code removal
  • 56. CONCLUSION Internal modules Classes/Interfaces Some typing External modules Type defs More typing Generics Type defs -noImplicitAny
  • 57. CONCLUSION TypeScript allows for gradual adoption Internal modules Classes/Interfaces Some typing External modules Type defs More typing Generics Type defs -noImplicitAny
  • 58. CONCLUSION Some downsides: Still need to know some JS quirks Current compiler slowish (faster one in the works) External module syntax not ES6-compatible (yet) Non-MS tooling lagging a bit
  • 59. CONCLUSION High value, low cost improvement over JavaScript Safer and more modular Solid path to ES6
  • 60. MORE TALKS TypeScript: Wednesday, 11:30 AM, same room !Akka & Event-sourcing Wednesday, 8:30 AM, same room @Sander_Mak Luminis Technologies
  • 61. RESOURCES Code: http://bit.ly/tscode ! Learn: www.typescriptlang.org/Handbook @Sander_Mak Luminis Technologies