SlideShare una empresa de Scribd logo
1 de 22
Descargar para leer sin conexión
Typed JavaScript
with TypeScript
Oliver Zeigermann
What is TypeScript?
•  Programming Language

•  Superset of JavaScript

•  Compiles to JavaScript

•  Adds Declared Types

•  Every valid JavaScript

•  Reduces boiler plate code

program also is a valid

•  Developed by Microsoft

TypeScript program

•  Head: Anders Hejlsberg
|

zeigermann.eu
TypeScript

http://www.typescriptlang.org
|

zeigermann.eu
Types
|

zeigermann.eu
Declared static types
•  TypeScript offers optional static typing
•  Type Inference can infer types even when you
do not declare them
•  Declared Types enable reliable IDE support

|

zeigermann.eu
Reliable IDE support for
•  Code Analysis

•  Refactoring

•  Code Completion

•  Type Hierarchies

•  Quick Fixes

•  Outline

|

zeigermann.eu
JavaScript IDEs offer that
without declared types, but…
not reliable!
•  Ever had a non-reliable Internet Connection?
•  Remember how that felt?
•  You want refactoring and code analysis to be reliable
|

zeigermann.eu
Optional Declared Types: Basics
var name = "Olli";

function doIt(p1, p2, p3) {
…
}
doIt(name);

|

zeigermann.eu
Optional Declared Types: Basics
var name: string = "Olli";

function doIt(p1: number, p2: boolean, p3: string): void {
…
}
doIt(name);

|

zeigermann.eu
IDE Support
•  Best IDEs
•  WebStorm / IntelliJ IDEA Ultimate
•  Visual Studio (Express only with limited support)

•  Full refactoring / Code completion etc.
•  Not quite at the level of Java-IDEs, yet
|

zeigermann.eu
Syntactic
Sugar
|

zeigermann.eu
JavaScript can express all this
•  classes

•  modules

•  interfaces

•  optional and default
parameters

•  inheritance

•  and more…

|

zeigermann.eu
JavaScript for Inheritance
__extends(Horse, Animal);
function Horse(name) {
Animal.call(this, name);
}
Horse.prototype.move = function () {
alert("Galloping...");
Animal.prototype.move.call(this, 45);
};

|

zeigermann.eu
Boiler Plate Code sucks
•  TypeScript offers syntactic sugar for those patterns
•  No other modifications to language
•  Compiler spits out best practice code

|

zeigermann.eu
TypeScript for Inheritance
class Horse extends Animal {
constructor(name: string) { super(name); }
move(): void {
alert("Galloping...");
super.move(45);
}
}

|

zeigermann.eu
Compare
|

zeigermann.eu
Comparing to CoffeeScript
CoffeeScript has in

CoffeeScript differs

common

•  Semantics (a little) different

•  Compiles to JavaScript

from JavaScript
•  No static type information

•  Classes and inheritance
as syntactic sugar

•  Fixes lexical scoping
|

zeigermann.eu
Comparing to Dart
Dart has in common

Dart differs

•  Optional static typing

•  Semantics different from
JavaScript

including Generics

•  Runs on Client and Server •  Can also be executed
natively in dedicated VM

•  Compiles to JavaScript
|

zeigermann.eu
Wrap-Up
•  Optional Declared Types enable premium IDE support
•  Syntactic sugar reduces boiler plate code
•  Still totally compatible with JavaScript
•  Added features aligned with ECMAScript Harmony
•  Dart and CoffeeScript both differ in Philosophy
|

zeigermann.eu
Where to apply?
•  Business Logic: totally
•  UI Logic only partially benefits from types
when accessed from template
•  Mixture of typed and untyped not an issue
•  Backend and frontend both cool
|

zeigermann.eu
And there is more!
•  Mapping files

•  Generics

•  External module

•  Casts

declarations for AMD /

•  All the ES 6 goodness

CommonJS

•  Declaration files for

•  Enums

JavaScript libraries
|

zeigermann.eu
Thanks for the attention!
Questions / Discussion!
!
!
Follow @DJCordhose
oliver@zeigermann.de
zeigermann.eu

Más contenido relacionado

La actualidad más candente

Ruby and Rails short motivation
Ruby and Rails short motivationRuby and Rails short motivation
Ruby and Rails short motivation
jistr
 
EclipseCon Europe 2011
EclipseCon Europe 2011EclipseCon Europe 2011
EclipseCon Europe 2011
Sigasi
 

La actualidad más candente (20)

OpenValue meetup July 2018 - Angular for Java developers
OpenValue meetup July 2018 - Angular for Java developersOpenValue meetup July 2018 - Angular for Java developers
OpenValue meetup July 2018 - Angular for Java developers
 
Code Nomads meetup June 2018 - Angular for Java developers
Code Nomads meetup June 2018 - Angular for Java developersCode Nomads meetup June 2018 - Angular for Java developers
Code Nomads meetup June 2018 - Angular for Java developers
 
J-Spring 2018 - Angular for Java developers
J-Spring 2018 - Angular for Java developersJ-Spring 2018 - Angular for Java developers
J-Spring 2018 - Angular for Java developers
 
Variables in Pharo5
Variables in Pharo5Variables in Pharo5
Variables in Pharo5
 
Lambda local - A local server for developing AWS Lambda function in Java
Lambda local - A local server for developing AWS Lambda function in JavaLambda local - A local server for developing AWS Lambda function in Java
Lambda local - A local server for developing AWS Lambda function in Java
 
Tweakers Developers Summit 2019 - Angular for backend developers
Tweakers Developers Summit 2019 - Angular for backend developersTweakers Developers Summit 2019 - Angular for backend developers
Tweakers Developers Summit 2019 - Angular for backend developers
 
Ruby and Rails short motivation
Ruby and Rails short motivationRuby and Rails short motivation
Ruby and Rails short motivation
 
Ansible, Idempotency, and Jenkins
Ansible, Idempotency, and JenkinsAnsible, Idempotency, and Jenkins
Ansible, Idempotency, and Jenkins
 
BDD API Tests with Gherkin and Behat
BDD API Tests with Gherkin and BehatBDD API Tests with Gherkin and Behat
BDD API Tests with Gherkin and Behat
 
Shortening the feedback loop: faster and better code development
Shortening the feedback loop: faster and better code developmentShortening the feedback loop: faster and better code development
Shortening the feedback loop: faster and better code development
 
EclipseCon Europe 2011
EclipseCon Europe 2011EclipseCon Europe 2011
EclipseCon Europe 2011
 
Vimperl
VimperlVimperl
Vimperl
 
Learn Elixir at Manchester Lambda Lounge
Learn Elixir at Manchester Lambda LoungeLearn Elixir at Manchester Lambda Lounge
Learn Elixir at Manchester Lambda Lounge
 
Why puppet? Why now?
Why puppet? Why now?Why puppet? Why now?
Why puppet? Why now?
 
Introduction to Scala for Java Developers
Introduction to Scala for Java DevelopersIntroduction to Scala for Java Developers
Introduction to Scala for Java Developers
 
Test automation with cucumber jvm
Test automation with cucumber jvmTest automation with cucumber jvm
Test automation with cucumber jvm
 
Getting started with scala cats
Getting started with scala catsGetting started with scala cats
Getting started with scala cats
 
5 hs mpostcustomizationrenefonseca
5 hs mpostcustomizationrenefonseca5 hs mpostcustomizationrenefonseca
5 hs mpostcustomizationrenefonseca
 
Using TypeScript with Angular
Using TypeScript with AngularUsing TypeScript with Angular
Using TypeScript with Angular
 
Ntd2015_pt_kanban_ppt
Ntd2015_pt_kanban_pptNtd2015_pt_kanban_ppt
Ntd2015_pt_kanban_ppt
 

Similar a Jazoon2013 type script

NetWork - 15.10.2011 - Applied code generation in .NET
NetWork - 15.10.2011 - Applied code generation in .NET NetWork - 15.10.2011 - Applied code generation in .NET
NetWork - 15.10.2011 - Applied code generation in .NET
Dmytro Mindra
 
All My Tests Are Passing, Now What?
All My Tests Are Passing, Now What?All My Tests Are Passing, Now What?
All My Tests Are Passing, Now What?
Christopher Read
 

Similar a Jazoon2013 type script (20)

Typescript Fundamentals
Typescript FundamentalsTypescript Fundamentals
Typescript Fundamentals
 
NetWork - 15.10.2011 - Applied code generation in .NET
NetWork - 15.10.2011 - Applied code generation in .NET NetWork - 15.10.2011 - Applied code generation in .NET
NetWork - 15.10.2011 - Applied code generation in .NET
 
Using type script to build better apps
Using type script to build better appsUsing type script to build better apps
Using type script to build better apps
 
Using type script to build better apps
Using type script to build better appsUsing type script to build better apps
Using type script to build better apps
 
Coding Standard And Code Review
Coding Standard And Code ReviewCoding Standard And Code Review
Coding Standard And Code Review
 
TypeScript
TypeScriptTypeScript
TypeScript
 
Compiler Construction
Compiler ConstructionCompiler Construction
Compiler Construction
 
TypeScript: Basic Features and Compilation Guide
TypeScript: Basic Features and Compilation GuideTypeScript: Basic Features and Compilation Guide
TypeScript: Basic Features and Compilation Guide
 
All My Tests Are Passing, Now What?
All My Tests Are Passing, Now What?All My Tests Are Passing, Now What?
All My Tests Are Passing, Now What?
 
Design Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best PracticesDesign Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best Practices
 
Hidden Treasure - TestComplete Script Extensions
Hidden Treasure - TestComplete Script ExtensionsHidden Treasure - TestComplete Script Extensions
Hidden Treasure - TestComplete Script Extensions
 
Design Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best PracticesDesign Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best Practices
 
Write Generic Code with the Tooling API
Write Generic Code with the Tooling APIWrite Generic Code with the Tooling API
Write Generic Code with the Tooling API
 
Babel.pptx
Babel.pptxBabel.pptx
Babel.pptx
 
TypeScript and Angular2 (Love at first sight)
TypeScript and Angular2 (Love at first sight)TypeScript and Angular2 (Love at first sight)
TypeScript and Angular2 (Love at first sight)
 
Getting Started with the TypeScript Language
Getting Started with the TypeScript LanguageGetting Started with the TypeScript Language
Getting Started with the TypeScript Language
 
C# basics...
C# basics...C# basics...
C# basics...
 
compiler and their types
compiler and their typescompiler and their types
compiler and their types
 
Making Scala Faster: 3 Expert Tips For Busy Development Teams
Making Scala Faster: 3 Expert Tips For Busy Development TeamsMaking Scala Faster: 3 Expert Tips For Busy Development Teams
Making Scala Faster: 3 Expert Tips For Busy Development Teams
 
.Net programming with C#
.Net programming with C#.Net programming with C#
.Net programming with C#
 

Último

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Último (20)

Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 

Jazoon2013 type script

  • 2. What is TypeScript? •  Programming Language •  Superset of JavaScript •  Compiles to JavaScript •  Adds Declared Types •  Every valid JavaScript •  Reduces boiler plate code program also is a valid •  Developed by Microsoft TypeScript program •  Head: Anders Hejlsberg | zeigermann.eu
  • 5. Declared static types •  TypeScript offers optional static typing •  Type Inference can infer types even when you do not declare them •  Declared Types enable reliable IDE support | zeigermann.eu
  • 6. Reliable IDE support for •  Code Analysis •  Refactoring •  Code Completion •  Type Hierarchies •  Quick Fixes •  Outline | zeigermann.eu
  • 7. JavaScript IDEs offer that without declared types, but… not reliable! •  Ever had a non-reliable Internet Connection? •  Remember how that felt? •  You want refactoring and code analysis to be reliable | zeigermann.eu
  • 8. Optional Declared Types: Basics var name = "Olli"; function doIt(p1, p2, p3) { … } doIt(name); | zeigermann.eu
  • 9. Optional Declared Types: Basics var name: string = "Olli"; function doIt(p1: number, p2: boolean, p3: string): void { … } doIt(name); | zeigermann.eu
  • 10. IDE Support •  Best IDEs •  WebStorm / IntelliJ IDEA Ultimate •  Visual Studio (Express only with limited support) •  Full refactoring / Code completion etc. •  Not quite at the level of Java-IDEs, yet | zeigermann.eu
  • 12. JavaScript can express all this •  classes •  modules •  interfaces •  optional and default parameters •  inheritance •  and more… | zeigermann.eu
  • 13. JavaScript for Inheritance __extends(Horse, Animal); function Horse(name) { Animal.call(this, name); } Horse.prototype.move = function () { alert("Galloping..."); Animal.prototype.move.call(this, 45); }; | zeigermann.eu
  • 14. Boiler Plate Code sucks •  TypeScript offers syntactic sugar for those patterns •  No other modifications to language •  Compiler spits out best practice code | zeigermann.eu
  • 15. TypeScript for Inheritance class Horse extends Animal { constructor(name: string) { super(name); } move(): void { alert("Galloping..."); super.move(45); } } | zeigermann.eu
  • 17. Comparing to CoffeeScript CoffeeScript has in CoffeeScript differs common •  Semantics (a little) different •  Compiles to JavaScript from JavaScript •  No static type information •  Classes and inheritance as syntactic sugar •  Fixes lexical scoping | zeigermann.eu
  • 18. Comparing to Dart Dart has in common Dart differs •  Optional static typing •  Semantics different from JavaScript including Generics •  Runs on Client and Server •  Can also be executed natively in dedicated VM •  Compiles to JavaScript | zeigermann.eu
  • 19. Wrap-Up •  Optional Declared Types enable premium IDE support •  Syntactic sugar reduces boiler plate code •  Still totally compatible with JavaScript •  Added features aligned with ECMAScript Harmony •  Dart and CoffeeScript both differ in Philosophy | zeigermann.eu
  • 20. Where to apply? •  Business Logic: totally •  UI Logic only partially benefits from types when accessed from template •  Mixture of typed and untyped not an issue •  Backend and frontend both cool | zeigermann.eu
  • 21. And there is more! •  Mapping files •  Generics •  External module •  Casts declarations for AMD / •  All the ES 6 goodness CommonJS •  Declaration files for •  Enums JavaScript libraries | zeigermann.eu
  • 22. Thanks for the attention! Questions / Discussion! ! ! Follow @DJCordhose oliver@zeigermann.de zeigermann.eu