SlideShare a Scribd company logo
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++ report
vikram mahendra
 
Operator overloading2
Operator overloading2Operator overloading2
Operator overloading2
zindadili
 
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
Ravi Bhadauria
 
Javascript Design Patterns
Javascript Design PatternsJavascript Design Patterns
Javascript Design Patterns
Zohar Arad
 
Categories for the Working C++ Programmer
Categories for the Working C++ ProgrammerCategories for the Working C++ Programmer
Categories for the Working C++ Programmer
Platonov Sergey
 
PWA night vol.11 20191218
PWA night vol.11 20191218PWA night vol.11 20191218
PWA night vol.11 20191218
bitpart
 
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
 
Cs practical file
Cs practical fileCs practical file
Cs practical file
Shailendra Garg
 
Types of Constructor in C++
Types of Constructor in C++Types of Constructor in C++
Types of Constructor in C++
Bhavik Vashi
 
JavaScript Core
JavaScript CoreJavaScript Core
JavaScript Core
François Sarradin
 
C++ file
C++ fileC++ file
C++ file
Mukund Trivedi
 
Design patterns in javascript
Design patterns in javascriptDesign patterns in javascript
Design patterns in javascript
Abimbola Idowu
 
04. constructor & destructor
04. constructor & destructor04. constructor & destructor
04. constructor & destructor
Haresh 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
 
C# programs
C# programsC# programs
C# programs
Gourav Pant
 
Functional programming in Java
Functional programming in Java  Functional programming in Java
Functional programming in Java
Haim Michael
 
Array notes
Array notesArray notes
Array notes
Hitesh Wagle
 
Muzzammilrashid
MuzzammilrashidMuzzammilrashid
Muzzammilrashid
muzzammilrashid
 
iOS,From Development to Distribution
iOS,From Development to DistributioniOS,From Development to Distribution
iOS,From Development to Distribution
Tunvir 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 SPANISH
Briean Jantes
 
Bitacora
BitacoraBitacora
Bitacora
Sowbek Hs
 
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
talkwalker
 
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
Eliezer Paez Gonzalez
 
Sukh
SukhSukh
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
Luís Ganhão
 
Pekatherm catalogue
Pekatherm cataloguePekatherm catalogue
Pekatherm catalogue
Mauro 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 age
Dr Mariann Hardey
 
Trabajo en equipo
Trabajo en equipoTrabajo en equipo
Lo sencillo es hermoso
Lo sencillo es hermosoLo sencillo es hermoso
Lo sencillo es hermoso
cepciencias
 
XXL ADVERTISING LIMITED_MAIL
XXL ADVERTISING LIMITED_MAILXXL ADVERTISING LIMITED_MAIL
XXL ADVERTISING LIMITED_MAIL
Baraka 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ñez
Candholy Carreto
 
5´s de la calidad.ygr
5´s de la calidad.ygr5´s de la calidad.ygr
5´s de la calidad.ygr
yvettegar
 
Tríptico Aixa Corpore
Tríptico Aixa CorporeTríptico Aixa Corpore
Tríptico Aixa Corpore
cholawer
 
Functional Web Development using Elm
Functional Web Development using ElmFunctional Web Development using Elm
Functional Web Development using Elm
💻 Spencer Schneidenbach
 

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 DSLs
intelliyole
 
Templates exception handling
Templates exception handlingTemplates exception handling
Templates exception handling
sanya6900
 
Exploring Angular 2 - Episode 1
Exploring Angular 2 - Episode 1Exploring Angular 2 - Episode 1
Exploring Angular 2 - Episode 1
Ahmed Moawad
 
Capstone ms2
Capstone ms2Capstone ms2
Capstone ms2
TanishGupta44
 
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 Melayi
Muhammed Thanveer M
 
A la découverte de TypeScript
A la découverte de TypeScriptA la découverte de TypeScript
A la découverte de TypeScript
Denis Voituron
 
Java doc Pr ITM2
Java doc Pr ITM2Java doc Pr ITM2
Java doc Pr ITM2
Aram Mohammed
 
Why rust?
Why rust?Why rust?
Why rust?
Mats Kindahl
 
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
CHOOSE
 
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
Shreesha Rao
 
Formatting ForThe Masses
Formatting ForThe MassesFormatting ForThe Masses
Formatting ForThe Masses
Holger 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ów
Konrad Kokosa
 
Bigger Stronger Faster
Bigger Stronger FasterBigger Stronger Faster
Bigger Stronger Faster
Chris Love
 
GHC Participant Training
GHC Participant TrainingGHC Participant Training
GHC Participant Training
AidIQ
 
IOC + Javascript
IOC + JavascriptIOC + Javascript
IOC + Javascript
Brian Cavalier
 
39927902 c-labmanual
39927902 c-labmanual39927902 c-labmanual
39927902 c-labmanual
Srinivasa Babji Josyula
 
Introduction to Django
Introduction to DjangoIntroduction to Django
Introduction to Django
Joaquim 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

Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |
AstuteBusiness
 
dbms calicut university B. sc Cs 4th sem.pdf
dbms  calicut university B. sc Cs 4th sem.pdfdbms  calicut university B. sc Cs 4th sem.pdf
dbms calicut university B. sc Cs 4th sem.pdf
Shinana2
 
Azure API Management to expose backend services securely
Azure API Management to expose backend services securelyAzure API Management to expose backend services securely
Azure API Management to expose backend services securely
Dinusha Kumarasiri
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
innovationoecd
 
System Design Case Study: Building a Scalable E-Commerce Platform - Hiike
System Design Case Study: Building a Scalable E-Commerce Platform - HiikeSystem Design Case Study: Building a Scalable E-Commerce Platform - Hiike
System Design Case Study: Building a Scalable E-Commerce Platform - Hiike
Hiike
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
Tomaz Bratanic
 
Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
Brandon Minnick, MBA
 
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their MainframeDigital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Precisely
 
Dandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity serverDandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity server
Antonios Katsarakis
 
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
Edge AI and Vision Alliance
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
Zilliz
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
Tatiana Kojar
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
Zilliz
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Tosin Akinosho
 
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing InstancesEnergy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Alpen-Adria-Universität
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
MichaelKnudsen27
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
ssuserfac0301
 
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-EfficiencyFreshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
ScyllaDB
 
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying AheadDigital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Wask
 

Recently uploaded (20)

Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |
 
dbms calicut university B. sc Cs 4th sem.pdf
dbms  calicut university B. sc Cs 4th sem.pdfdbms  calicut university B. sc Cs 4th sem.pdf
dbms calicut university B. sc Cs 4th sem.pdf
 
Azure API Management to expose backend services securely
Azure API Management to expose backend services securelyAzure API Management to expose backend services securely
Azure API Management to expose backend services securely
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
 
System Design Case Study: Building a Scalable E-Commerce Platform - Hiike
System Design Case Study: Building a Scalable E-Commerce Platform - HiikeSystem Design Case Study: Building a Scalable E-Commerce Platform - Hiike
System Design Case Study: Building a Scalable E-Commerce Platform - Hiike
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
 
Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
 
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their MainframeDigital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
 
Dandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity serverDandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity server
 
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
 
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing InstancesEnergy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
 
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-EfficiencyFreshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
 
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying AheadDigital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying Ahead
 

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