SlideShare a Scribd company logo
1 of 50
Download to read offline
TypeScript
Tobias Meier, BridgingIT GmbH
Tobias.Meier@bridging-it.de @bITTobiasMeier
Tobias Meier
Lead Softwarearchitekt Microsoftdging-it.de
Standort Karlsruhe
Rüppurrer Straße 4
76137 Karlsruhe
Standort Stuttgart
Königstraße 42
70173 Stuttgart
Standort Zug
(Schweiz)
Baarerstraße 14
CH-6300 Zug
Standort Mannheim
N7, 5-6
68161 Mannheim
Standort Frankfurt
Solmsstraße 4
60486 Frankfurt
Standort München
Theresienhöhe 28
80339 München
Standort Köln
Waidmarkt 11
50676 Köln
Wir bringen Dinge zusammen
Agenda
 Bestandsaufnahme
 Überblick TypeScript
 Toolchain
 Details
JavaScript
JavaScript
 Intellisense
 Typsicherheit
 Compiler
 Refactoring
 …….
 Are you saying you cannot write large programs in
JavaScript ?
 No, you can write large programs in JavaScript. You just
can’t maintain them.
Erik Meijer
Anders Hejlsberg
http://channel9.msdn.com/Events/Lang-NEXT/Lang-NEXT-2012/Panel-Web-and-Cloud-Programming
(02.04.2012, ca. 11. Min.)
TypeScript 0.8
 Typsicherheit
 Vererbung
 Module
 Compiler
 Superset von JavaScript
http://www.typescriptlang.org/Playground
Datentypen: Number
var zahl: number;
var zahl2 = 33;
zahl = 2;
zahl = "abc";
//Implizit Datentyp number
Interfaces, Klassen und Vererbung
interface IFahrzeug {
fahren(kmh: number): void;
bremsen?():void;
}
class Auto implements IFahrzeug {
fahren(kmh: number): void {
var span = document.
createElement('span');
span.textContent = "fahre " +
kmh.toLocaleString();
document.body.appendChild(span);
}
}
var __extends = this.__extends ||
function (d, b) {
for (var p in b)
if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
__.prototype = b.prototype;
d.prototype = new __();
};
var Auto = (function () {
function Auto() { }
Auto.prototype.fahren = function (kmh) {
var span = document.createElement('span');
span.textContent = "fahre " +
kmh.toLocaleString();
document.body.appendChild(span);
};
return Auto;
})(); IFFE
Interfaces, Klassen und Vererbung
var Tesla = (function (_super) {
__extends(Tesla, _super);
function Tesla() {
_super.apply( this, arguments);
}
return Tesla;
})(Auto);
var fahrzeug;
fahrzeug = new Tesla();
fahrzeug.fahren(20);
class Tesla extends Auto { }
var fahrzeug: IFahrzeug;
fahrzeug = new Tesla();
fahrzeug.fahren(20);
Casting
var auto = <Auto>meinMercedes;
var fahrzeug = <any> auto;
Declaration
declare var $;
Typdefinitionen verwenden
 Interfacedefinitionen
 Sammlung für alle gängigen Bibliotheken:
https://github.com/borisyankov/DefinitelyTyped
 Über NuGet
Typdefinitionen erzeugen
Browser führt
JavaScript aus
TypeScript
Quellcode
SourceMap
Demo
 Intellisense, Refactoring
 Referenzieren, Typedefinitions
 Konfigurationsmöglichkeiten
 Debuggen
Alphaversion –
trotzdem produktiv
verwenden ?
Und im Notfall ?
Meine Toolchain
 Visual Studio 2013, 2015
 IE / Chrome
 Web Essentials
 TSLint
 Resharper
Nur eine Javascript-Datei
Details
 Properties
 Datentypen
 Lambda Expressions
 Module
Properties
var auto = new Auto();
auto.kmh = 100;
class Auto {
private _kmh: number;
get kmh(): number {
return this._kmh;
}
set kmh(value: number) {
this._kmh = value;
}
}
Wichtigste Neuerung
in .Net 2.0 ?
Datentypen: Generics
export class Example extends Blume {
constructor(private list: Array<number>) {
}
add(val:number):void {
this.list.push(val);
}
}
var data: Array<number>;
var example = new Example(data);
example.add(10);
Example.add ("Hallo"); //Fehler
Datentypen: Generics
export class GenericClass<T extends Example> {
constructor(private value: T) {
}
}
var data : Array<number>;
var a1 = new GenericClass(new Example(data));
var a2 = new GenericClass(10);
Datentypen: Union Types
function f(x: number | number[]) {
if (typeof x === "number") {
return x + 10;
} else {
// return sum of numbers
}
}
Datentypen: Enums
enum Color {Red, Green, Yellow)
var mycolor = Color.Green;
var Color;
(function (Color) {
Color[Color["Red"] = 0] = "Red";
Color[Color["Green"] = 1] = "Green";
Color[Color["Yellow"] = 2] = "Yellow";
})(Color || (Color = {}));
var mycolor = 1 /* Green */;
Datentypen: Konstante Enums
const enum Color {Red, Green, Yellow)
var mycolor = Color.Green;
var mycolor = 1 /* Green */;
Type Aliase
type BoolArray = Array<boolean>;
type NumberCallback = (zahl:number) => void;
instanceof
class Dog { woof() { } }
class Cat { meow() { } }
var pet: Dog|Cat = /* ... */;
if(pet instanceof Dog) {
pet.woof();
} else {
pet.woof();
}
„this“ und JavaScript
class Greeter{
//...
start() {
this.timerToken = setInterval(function () {
this.span.innerHTML = new Date().toUTCString();
}
, 500);
}
}
„this“ und JavaScript
class Greeter{
//...
start() {
var _this = this;
this.timerToken = setInterval(function () {
_this.span.innerHTML = new Date().toUTCString();
}
, 500);
}
}
Lambda und „this“
start() {
this.timerToken = setInterval(() =>
this.span.innerHTML = new Date().toUTCString()
, 500);
}
Interne Module
module demo{
export class ExpAuto{
constructor (data:string){
}
}
}
var auto1 =
new demo.ExpAuto ("Tesla");
import MyAuto = demo.ExpAuto;
var auto2 = new MyAuto()
Externe Module
 AMD oder CommonJS
 module nicht notwendig
 export genügt
//Datei fahrzeug.ts
export class ExpAuto{
constructor (data:string){
}
}
import car=
require("fahrzeug");
var auto = new car.ExpAuto("Tesla");
Externe Module
//Datei fahrzeug.ts
class ExpAuto{
constructor (data:string){
}
}
export = ExpAuto;
import car=
require("fahrzeug");
var auto = new car("Tesla");
Scopes
test() {
var x = 3;
this.addMsg("x:" + x.toLocaleString());
if (x === 3){
var x = 2;
this.addMsg("x (im IF):" + x.toLocaleString());
}
this.addMsg("x (außerhalb):" + x.toLocaleString());
}
Mehr Scopes dank Let
test() {
var x = 3;
this.addMsg("x:" + x.toLocaleString());
if (x === 3){
let x = 2;
this.addMsg("x (im IF):" + x.toLocaleString());
}
this.addMsg("x (außerhalb):" + x.toLocaleString());
}
Demo
EcmaScript 6 - Syntax
Voraussetzung
 Windows 10 Preview März
 Visual Studio 2015 CTP 6
Angular 2: Built on TypeScript
We're excited to unveil the result of a months-long
partnership with the Angular team.
This partnership has been very productive and rewarding
experience for us, and as part of this collaboration, we're
happy to announce that Angular 2 will now be built with
TypeScript. We're looking forward to seeing what people will
be able to do with these new tools and continuing to work
with the Angular team to improve the experience for Angular
developers.
Jonathan Turner [MS] am 05.03.2015
Quelle: http://blogs.msdn.com/b/typescript/archive/2015/03/05/angular-2-0-built-on-typescript.aspx
Typescript 1.5 (Alpha)
 Neue ES6-Features
 Let/const werden auch
nach ES5 kompiliert
 Decorators
 Sublime Text plugin
TypeScript
Was es kann
 Typsicherheit
 Vererbung (Prototypal Inheritance)
 Module-Management
 Gültigkeitsbereiche (teilweise)
 Basis für besseren Refactoring-Support
Was es nicht kann:
 JavaScript ersetzen
Vielen Dank
 http://www.typescript-lang.org
 http://blogs.msdn.com/b/typescript
Email: Tobias.Meier@bridging-it.de Twitter: @bITTobiasMeier

More Related Content

What's hot

programming in C++ report
programming in C++ reportprogramming in C++ report
programming in C++ reportvikram mahendra
 
Operator overloading2
Operator overloading2Operator overloading2
Operator overloading2zindadili
 
Design patterns in java script, jquery, angularjs
Design patterns in java script, jquery, angularjsDesign patterns in java script, jquery, angularjs
Design patterns in java script, jquery, angularjsRavi Bhadauria
 
Javascript Design Patterns
Javascript Design PatternsJavascript Design Patterns
Javascript Design PatternsZohar Arad
 
Categories for the Working C++ Programmer
Categories for the Working C++ ProgrammerCategories for the Working C++ Programmer
Categories for the Working C++ ProgrammerPlatonov Sergey
 
PWA night vol.11 20191218
PWA night vol.11 20191218PWA night vol.11 20191218
PWA night vol.11 20191218bitpart
 
Parallel and Async Programming With C#
Parallel and Async Programming With C#Parallel and Async Programming With C#
Parallel and Async Programming With C#Rainer Stropek
 
Types of Constructor in C++
Types of Constructor in C++Types of Constructor in C++
Types of Constructor in C++Bhavik Vashi
 
Design patterns in javascript
Design patterns in javascriptDesign patterns in javascript
Design patterns in javascriptAbimbola Idowu
 
04. constructor & destructor
04. constructor & destructor04. constructor & destructor
04. constructor & destructorHaresh Jaiswal
 
Practical Class 12th (c++programs+sql queries and output)
Practical Class 12th (c++programs+sql queries and output) Practical Class 12th (c++programs+sql queries and output)
Practical Class 12th (c++programs+sql queries and output) Aman Deep
 
Functional programming in Java
Functional programming in Java  Functional programming in Java
Functional programming in Java Haim Michael
 
iOS,From Development to Distribution
iOS,From Development to DistributioniOS,From Development to Distribution
iOS,From Development to DistributionTunvir Rahman Tusher
 

What's hot (19)

programming in C++ report
programming in C++ reportprogramming in C++ report
programming in C++ report
 
Operator overloading2
Operator overloading2Operator overloading2
Operator overloading2
 
Design patterns in java script, jquery, angularjs
Design patterns in java script, jquery, angularjsDesign patterns in java script, jquery, angularjs
Design patterns in java script, jquery, angularjs
 
Javascript Design Patterns
Javascript Design PatternsJavascript Design Patterns
Javascript Design Patterns
 
Categories for the Working C++ Programmer
Categories for the Working C++ ProgrammerCategories for the Working C++ Programmer
Categories for the Working C++ Programmer
 
PWA night vol.11 20191218
PWA night vol.11 20191218PWA night vol.11 20191218
PWA night vol.11 20191218
 
Parallel and Async Programming With C#
Parallel and Async Programming With C#Parallel and Async Programming With C#
Parallel and Async Programming With C#
 
Cs practical file
Cs practical fileCs practical file
Cs practical file
 
Types of Constructor in C++
Types of Constructor in C++Types of Constructor in C++
Types of Constructor in C++
 
JavaScript Core
JavaScript CoreJavaScript Core
JavaScript Core
 
C++ file
C++ fileC++ file
C++ file
 
Design patterns in javascript
Design patterns in javascriptDesign patterns in javascript
Design patterns in javascript
 
04. constructor & destructor
04. constructor & destructor04. constructor & destructor
04. constructor & destructor
 
Practical Class 12th (c++programs+sql queries and output)
Practical Class 12th (c++programs+sql queries and output) Practical Class 12th (c++programs+sql queries and output)
Practical Class 12th (c++programs+sql queries and output)
 
C# programs
C# programsC# programs
C# programs
 
Functional programming in Java
Functional programming in Java  Functional programming in Java
Functional programming in Java
 
Array notes
Array notesArray notes
Array notes
 
Muzzammilrashid
MuzzammilrashidMuzzammilrashid
Muzzammilrashid
 
iOS,From Development to Distribution
iOS,From Development to DistributioniOS,From Development to Distribution
iOS,From Development to Distribution
 

Viewers also liked

JavaScript für Java-Entwickler W-JAX 2013
JavaScript für Java-Entwickler W-JAX 2013JavaScript für Java-Entwickler W-JAX 2013
JavaScript für Java-Entwickler W-JAX 2013Oliver Zeigermann
 
ASP.NET Core - Phillosophies, Processes and Tooling
ASP.NET Core - Phillosophies, Processes and ToolingASP.NET Core - Phillosophies, Processes and Tooling
ASP.NET Core - Phillosophies, Processes and Tooling💻 Spencer Schneidenbach
 
The Harbor brochure SPANISH
The Harbor brochure SPANISHThe Harbor brochure SPANISH
The Harbor brochure SPANISHBriean Jantes
 
Social media monitoring 2013 - Wegweiser durch den Dschungel
Social media monitoring 2013 - Wegweiser durch den DschungelSocial media monitoring 2013 - Wegweiser durch den Dschungel
Social media monitoring 2013 - Wegweiser durch den Dschungeltalkwalker
 
Sistemas de comunciaciones por satélite e. paez
Sistemas de comunciaciones por satélite   e. paezSistemas de comunciaciones por satélite   e. paez
Sistemas de comunciaciones por satélite e. paezEliezer Paez Gonzalez
 
Cumulus Ciclo De Vida Do Cloud Stratus, Altostratus E Cirrus
Cumulus   Ciclo De Vida Do Cloud   Stratus, Altostratus E CirrusCumulus   Ciclo De Vida Do Cloud   Stratus, Altostratus E Cirrus
Cumulus Ciclo De Vida Do Cloud Stratus, Altostratus E CirrusLuís Ganhão
 
Pekatherm catalogue
Pekatherm cataloguePekatherm catalogue
Pekatherm catalogueMauro Ponzè
 
From Watermelon to Peach - the workplace for a digital age
From Watermelon to Peach - the workplace for a digital ageFrom Watermelon to Peach - the workplace for a digital age
From Watermelon to Peach - the workplace for a digital ageDr Mariann Hardey
 
Lo sencillo es hermoso
Lo sencillo es hermosoLo sencillo es hermoso
Lo sencillo es hermosocepciencias
 
XXL ADVERTISING LIMITED_MAIL
XXL ADVERTISING LIMITED_MAILXXL ADVERTISING LIMITED_MAIL
XXL ADVERTISING LIMITED_MAILBaraka Mtavangu
 
Estrategias de Marketing Prof. Ronald Ordoñez
Estrategias de Marketing Prof. Ronald OrdoñezEstrategias de Marketing Prof. Ronald Ordoñez
Estrategias de Marketing Prof. Ronald OrdoñezCandholy Carreto
 
5´s de la calidad.ygr
5´s de la calidad.ygr5´s de la calidad.ygr
5´s de la calidad.ygryvettegar
 
Tríptico Aixa Corpore
Tríptico Aixa CorporeTríptico Aixa Corpore
Tríptico Aixa Corporecholawer
 

Viewers also liked (20)

JavaScript für Java-Entwickler W-JAX 2013
JavaScript für Java-Entwickler W-JAX 2013JavaScript für Java-Entwickler W-JAX 2013
JavaScript für Java-Entwickler W-JAX 2013
 
ASP.NET Core - Phillosophies, Processes and Tooling
ASP.NET Core - Phillosophies, Processes and ToolingASP.NET Core - Phillosophies, Processes and Tooling
ASP.NET Core - Phillosophies, Processes and Tooling
 
Lebenslauf
LebenslaufLebenslauf
Lebenslauf
 
The Harbor brochure SPANISH
The Harbor brochure SPANISHThe Harbor brochure SPANISH
The Harbor brochure SPANISH
 
Bitacora
BitacoraBitacora
Bitacora
 
Social media monitoring 2013 - Wegweiser durch den Dschungel
Social media monitoring 2013 - Wegweiser durch den DschungelSocial media monitoring 2013 - Wegweiser durch den Dschungel
Social media monitoring 2013 - Wegweiser durch den Dschungel
 
Sistemas de comunciaciones por satélite e. paez
Sistemas de comunciaciones por satélite   e. paezSistemas de comunciaciones por satélite   e. paez
Sistemas de comunciaciones por satélite e. paez
 
Sukh
SukhSukh
Sukh
 
Ioga
IogaIoga
Ioga
 
Cumulus Ciclo De Vida Do Cloud Stratus, Altostratus E Cirrus
Cumulus   Ciclo De Vida Do Cloud   Stratus, Altostratus E CirrusCumulus   Ciclo De Vida Do Cloud   Stratus, Altostratus E Cirrus
Cumulus Ciclo De Vida Do Cloud Stratus, Altostratus E Cirrus
 
Nom planetes
Nom planetesNom planetes
Nom planetes
 
Pekatherm catalogue
Pekatherm cataloguePekatherm catalogue
Pekatherm catalogue
 
From Watermelon to Peach - the workplace for a digital age
From Watermelon to Peach - the workplace for a digital ageFrom Watermelon to Peach - the workplace for a digital age
From Watermelon to Peach - the workplace for a digital age
 
Trabajo en equipo
Trabajo en equipoTrabajo en equipo
Trabajo en equipo
 
Lo sencillo es hermoso
Lo sencillo es hermosoLo sencillo es hermoso
Lo sencillo es hermoso
 
XXL ADVERTISING LIMITED_MAIL
XXL ADVERTISING LIMITED_MAILXXL ADVERTISING LIMITED_MAIL
XXL ADVERTISING LIMITED_MAIL
 
Estrategias de Marketing Prof. Ronald Ordoñez
Estrategias de Marketing Prof. Ronald OrdoñezEstrategias de Marketing Prof. Ronald Ordoñez
Estrategias de Marketing Prof. Ronald Ordoñez
 
5´s de la calidad.ygr
5´s de la calidad.ygr5´s de la calidad.ygr
5´s de la calidad.ygr
 
Tríptico Aixa Corpore
Tríptico Aixa CorporeTríptico Aixa Corpore
Tríptico Aixa Corpore
 
Functional Web Development using Elm
Functional Web Development using ElmFunctional Web Development using Elm
Functional Web Development using Elm
 

Similar to 29. Treffen - Tobias Meier - TypeScript

Matúš Cimerman: Building AI data pipelines using PySpark, PyData Bratislava M...
Matúš Cimerman: Building AI data pipelines using PySpark, PyData Bratislava M...Matúš Cimerman: Building AI data pipelines using PySpark, PyData Bratislava M...
Matúš Cimerman: Building AI data pipelines using PySpark, PyData Bratislava M...GapData Institute
 
Google App Engine in 40 minutes (the absolute essentials)
Google App Engine in 40 minutes (the absolute essentials)Google App Engine in 40 minutes (the absolute essentials)
Google App Engine in 40 minutes (the absolute essentials)Python Ireland
 
Smoothing Your Java with DSLs
Smoothing Your Java with DSLsSmoothing Your Java with DSLs
Smoothing Your Java with DSLsintelliyole
 
Templates exception handling
Templates exception handlingTemplates exception handling
Templates exception handlingsanya6900
 
Exploring Angular 2 - Episode 1
Exploring Angular 2 - Episode 1Exploring Angular 2 - Episode 1
Exploring Angular 2 - Episode 1Ahmed Moawad
 
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)Igor Bronovskyy
 
Oop concept in c++ by MUhammed Thanveer Melayi
Oop concept in c++ by MUhammed Thanveer MelayiOop concept in c++ by MUhammed Thanveer Melayi
Oop concept in c++ by MUhammed Thanveer MelayiMuhammed Thanveer M
 
A la découverte de TypeScript
A la découverte de TypeScriptA la découverte de TypeScript
A la découverte de TypeScriptDenis Voituron
 
Choose'10: Ralf Laemmel - Dealing Confortably with the Confusion of Tongues
Choose'10: Ralf Laemmel - Dealing Confortably with the Confusion of TonguesChoose'10: Ralf Laemmel - Dealing Confortably with the Confusion of Tongues
Choose'10: Ralf Laemmel - Dealing Confortably with the Confusion of TonguesCHOOSE
 
Borland star team to tfs simple migration
Borland star team to tfs simple migrationBorland star team to tfs simple migration
Borland star team to tfs simple migrationShreesha Rao
 
Formatting ForThe Masses
Formatting ForThe MassesFormatting ForThe Masses
Formatting ForThe MassesHolger Schill
 
A miało być tak... bez wycieków
A miało być tak... bez wyciekówA miało być tak... bez wycieków
A miało być tak... bez wyciekówKonrad Kokosa
 
Bigger Stronger Faster
Bigger Stronger FasterBigger Stronger Faster
Bigger Stronger FasterChris Love
 
GHC Participant Training
GHC Participant TrainingGHC Participant Training
GHC Participant TrainingAidIQ
 
Introduction to Django
Introduction to DjangoIntroduction to Django
Introduction to DjangoJoaquim Rocha
 

Similar to 29. Treffen - Tobias Meier - TypeScript (20)

Matúš Cimerman: Building AI data pipelines using PySpark, PyData Bratislava M...
Matúš Cimerman: Building AI data pipelines using PySpark, PyData Bratislava M...Matúš Cimerman: Building AI data pipelines using PySpark, PyData Bratislava M...
Matúš Cimerman: Building AI data pipelines using PySpark, PyData Bratislava M...
 
Google App Engine in 40 minutes (the absolute essentials)
Google App Engine in 40 minutes (the absolute essentials)Google App Engine in 40 minutes (the absolute essentials)
Google App Engine in 40 minutes (the absolute essentials)
 
Smoothing Your Java with DSLs
Smoothing Your Java with DSLsSmoothing Your Java with DSLs
Smoothing Your Java with DSLs
 
Templates exception handling
Templates exception handlingTemplates exception handling
Templates exception handling
 
Exploring Angular 2 - Episode 1
Exploring Angular 2 - Episode 1Exploring Angular 2 - Episode 1
Exploring Angular 2 - Episode 1
 
Capstone ms2
Capstone ms2Capstone ms2
Capstone ms2
 
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)
 
Oop concept in c++ by MUhammed Thanveer Melayi
Oop concept in c++ by MUhammed Thanveer MelayiOop concept in c++ by MUhammed Thanveer Melayi
Oop concept in c++ by MUhammed Thanveer Melayi
 
A la découverte de TypeScript
A la découverte de TypeScriptA la découverte de TypeScript
A la découverte de TypeScript
 
Java doc Pr ITM2
Java doc Pr ITM2Java doc Pr ITM2
Java doc Pr ITM2
 
Why rust?
Why rust?Why rust?
Why rust?
 
Choose'10: Ralf Laemmel - Dealing Confortably with the Confusion of Tongues
Choose'10: Ralf Laemmel - Dealing Confortably with the Confusion of TonguesChoose'10: Ralf Laemmel - Dealing Confortably with the Confusion of Tongues
Choose'10: Ralf Laemmel - Dealing Confortably with the Confusion of Tongues
 
Borland star team to tfs simple migration
Borland star team to tfs simple migrationBorland star team to tfs simple migration
Borland star team to tfs simple migration
 
Formatting ForThe Masses
Formatting ForThe MassesFormatting ForThe Masses
Formatting ForThe Masses
 
A miało być tak... bez wycieków
A miało być tak... bez wyciekówA miało być tak... bez wycieków
A miało być tak... bez wycieków
 
Bigger Stronger Faster
Bigger Stronger FasterBigger Stronger Faster
Bigger Stronger Faster
 
GHC Participant Training
GHC Participant TrainingGHC Participant Training
GHC Participant Training
 
IOC + Javascript
IOC + JavascriptIOC + Javascript
IOC + Javascript
 
39927902 c-labmanual
39927902 c-labmanual39927902 c-labmanual
39927902 c-labmanual
 
Introduction to Django
Introduction to DjangoIntroduction to Django
Introduction to Django
 

Recently uploaded

Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 

Recently uploaded (20)

Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 

29. Treffen - Tobias Meier - TypeScript

  • 1. TypeScript Tobias Meier, BridgingIT GmbH Tobias.Meier@bridging-it.de @bITTobiasMeier
  • 2. Tobias Meier Lead Softwarearchitekt Microsoftdging-it.de Standort Karlsruhe Rüppurrer Straße 4 76137 Karlsruhe Standort Stuttgart Königstraße 42 70173 Stuttgart Standort Zug (Schweiz) Baarerstraße 14 CH-6300 Zug Standort Mannheim N7, 5-6 68161 Mannheim Standort Frankfurt Solmsstraße 4 60486 Frankfurt Standort München Theresienhöhe 28 80339 München Standort Köln Waidmarkt 11 50676 Köln Wir bringen Dinge zusammen
  • 3. Agenda  Bestandsaufnahme  Überblick TypeScript  Toolchain  Details
  • 5.
  • 6.
  • 7.
  • 8.
  • 9. JavaScript  Intellisense  Typsicherheit  Compiler  Refactoring  …….
  • 10.  Are you saying you cannot write large programs in JavaScript ?  No, you can write large programs in JavaScript. You just can’t maintain them. Erik Meijer Anders Hejlsberg http://channel9.msdn.com/Events/Lang-NEXT/Lang-NEXT-2012/Panel-Web-and-Cloud-Programming (02.04.2012, ca. 11. Min.)
  • 11.
  • 12. TypeScript 0.8  Typsicherheit  Vererbung  Module  Compiler  Superset von JavaScript
  • 14. Datentypen: Number var zahl: number; var zahl2 = 33; zahl = 2; zahl = "abc"; //Implizit Datentyp number
  • 15. Interfaces, Klassen und Vererbung interface IFahrzeug { fahren(kmh: number): void; bremsen?():void; } class Auto implements IFahrzeug { fahren(kmh: number): void { var span = document. createElement('span'); span.textContent = "fahre " + kmh.toLocaleString(); document.body.appendChild(span); } } var __extends = this.__extends || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } __.prototype = b.prototype; d.prototype = new __(); }; var Auto = (function () { function Auto() { } Auto.prototype.fahren = function (kmh) { var span = document.createElement('span'); span.textContent = "fahre " + kmh.toLocaleString(); document.body.appendChild(span); }; return Auto; })(); IFFE
  • 16. Interfaces, Klassen und Vererbung var Tesla = (function (_super) { __extends(Tesla, _super); function Tesla() { _super.apply( this, arguments); } return Tesla; })(Auto); var fahrzeug; fahrzeug = new Tesla(); fahrzeug.fahren(20); class Tesla extends Auto { } var fahrzeug: IFahrzeug; fahrzeug = new Tesla(); fahrzeug.fahren(20);
  • 17. Casting var auto = <Auto>meinMercedes; var fahrzeug = <any> auto;
  • 19. Typdefinitionen verwenden  Interfacedefinitionen  Sammlung für alle gängigen Bibliotheken: https://github.com/borisyankov/DefinitelyTyped  Über NuGet
  • 21.
  • 23. Demo  Intellisense, Refactoring  Referenzieren, Typedefinitions  Konfigurationsmöglichkeiten  Debuggen
  • 26. Meine Toolchain  Visual Studio 2013, 2015  IE / Chrome  Web Essentials  TSLint  Resharper
  • 28. Details  Properties  Datentypen  Lambda Expressions  Module
  • 29. Properties var auto = new Auto(); auto.kmh = 100; class Auto { private _kmh: number; get kmh(): number { return this._kmh; } set kmh(value: number) { this._kmh = value; } }
  • 31. Datentypen: Generics export class Example extends Blume { constructor(private list: Array<number>) { } add(val:number):void { this.list.push(val); } } var data: Array<number>; var example = new Example(data); example.add(10); Example.add ("Hallo"); //Fehler
  • 32. Datentypen: Generics export class GenericClass<T extends Example> { constructor(private value: T) { } } var data : Array<number>; var a1 = new GenericClass(new Example(data)); var a2 = new GenericClass(10);
  • 33. Datentypen: Union Types function f(x: number | number[]) { if (typeof x === "number") { return x + 10; } else { // return sum of numbers } }
  • 34. Datentypen: Enums enum Color {Red, Green, Yellow) var mycolor = Color.Green; var Color; (function (Color) { Color[Color["Red"] = 0] = "Red"; Color[Color["Green"] = 1] = "Green"; Color[Color["Yellow"] = 2] = "Yellow"; })(Color || (Color = {})); var mycolor = 1 /* Green */;
  • 35. Datentypen: Konstante Enums const enum Color {Red, Green, Yellow) var mycolor = Color.Green; var mycolor = 1 /* Green */;
  • 36. Type Aliase type BoolArray = Array<boolean>; type NumberCallback = (zahl:number) => void;
  • 37. instanceof class Dog { woof() { } } class Cat { meow() { } } var pet: Dog|Cat = /* ... */; if(pet instanceof Dog) { pet.woof(); } else { pet.woof(); }
  • 38. „this“ und JavaScript class Greeter{ //... start() { this.timerToken = setInterval(function () { this.span.innerHTML = new Date().toUTCString(); } , 500); } }
  • 39. „this“ und JavaScript class Greeter{ //... start() { var _this = this; this.timerToken = setInterval(function () { _this.span.innerHTML = new Date().toUTCString(); } , 500); } }
  • 40. Lambda und „this“ start() { this.timerToken = setInterval(() => this.span.innerHTML = new Date().toUTCString() , 500); }
  • 41. Interne Module module demo{ export class ExpAuto{ constructor (data:string){ } } } var auto1 = new demo.ExpAuto ("Tesla"); import MyAuto = demo.ExpAuto; var auto2 = new MyAuto()
  • 42. Externe Module  AMD oder CommonJS  module nicht notwendig  export genügt //Datei fahrzeug.ts export class ExpAuto{ constructor (data:string){ } } import car= require("fahrzeug"); var auto = new car.ExpAuto("Tesla");
  • 43. Externe Module //Datei fahrzeug.ts class ExpAuto{ constructor (data:string){ } } export = ExpAuto; import car= require("fahrzeug"); var auto = new car("Tesla");
  • 44. Scopes test() { var x = 3; this.addMsg("x:" + x.toLocaleString()); if (x === 3){ var x = 2; this.addMsg("x (im IF):" + x.toLocaleString()); } this.addMsg("x (außerhalb):" + x.toLocaleString()); }
  • 45. Mehr Scopes dank Let test() { var x = 3; this.addMsg("x:" + x.toLocaleString()); if (x === 3){ let x = 2; this.addMsg("x (im IF):" + x.toLocaleString()); } this.addMsg("x (außerhalb):" + x.toLocaleString()); }
  • 46. Demo EcmaScript 6 - Syntax Voraussetzung  Windows 10 Preview März  Visual Studio 2015 CTP 6
  • 47. Angular 2: Built on TypeScript We're excited to unveil the result of a months-long partnership with the Angular team. This partnership has been very productive and rewarding experience for us, and as part of this collaboration, we're happy to announce that Angular 2 will now be built with TypeScript. We're looking forward to seeing what people will be able to do with these new tools and continuing to work with the Angular team to improve the experience for Angular developers. Jonathan Turner [MS] am 05.03.2015 Quelle: http://blogs.msdn.com/b/typescript/archive/2015/03/05/angular-2-0-built-on-typescript.aspx
  • 48. Typescript 1.5 (Alpha)  Neue ES6-Features  Let/const werden auch nach ES5 kompiliert  Decorators  Sublime Text plugin
  • 49. TypeScript Was es kann  Typsicherheit  Vererbung (Prototypal Inheritance)  Module-Management  Gültigkeitsbereiche (teilweise)  Basis für besseren Refactoring-Support Was es nicht kann:  JavaScript ersetzen
  • 50. Vielen Dank  http://www.typescript-lang.org  http://blogs.msdn.com/b/typescript Email: Tobias.Meier@bridging-it.de Twitter: @bITTobiasMeier