Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Warum TypeScript?
Search
Joshy Cyriac
September 18, 2015
Programming
150
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Warum TypeScript?
Talk given at bed-con.org in Berlin 2015
Joshy Cyriac
September 18, 2015
Other Decks in Programming
See All in Programming
VibeCodingからAgenticWorkflowへ
starfish719
0
430
改善しないと、タスクが回らない。 “てんこ盛りポジション” を引き継いだ情シスの、入社3ヶ月の業務改善録
krm963
0
260
jsmini JavaScript Engine を作ってみた話
yosuke_furukawa
PRO
0
320
【QA Test Talk Vol.8】AI-DLC による Whole Team Approach の加速
pkshadeck
PRO
0
180
Go 1.27 における memory allocation の高速化
andpad
0
170
170k Jobs a Day on GKE: Scaling Mercari's CI Platform - and What's Next for AI-Native Development
junyaokabe
0
110
PostgreSQL 18で考えるUUID主キー
kazuhiro1982
0
470
20260722_microCMSで考える、AI時代のコンテンツ運用設計
yosh1
0
400
Cloudflare is Agents
chimame
0
160
「人を評価する AI」の設計と実装
ryoyanara
0
200
自動化したのに回らない テスト運用の壁―AI時代の品質責任と生産性
mfunaki
0
160
Google Apps Script で Ruby を動かす
kawahara
0
220
Featured
See All Featured
Statistics for Hackers
jakevdp
799
230k
The Cost Of JavaScript in 2023
addyosmani
55
10k
Thoughts on Productivity
jonyablonski
76
5.3k
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
73
41k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
AI: The stuff that nobody shows you
jnunemaker
PRO
9
910
Exploring anti-patterns in Rails
aemeredith
3
460
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
128
56k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
23k
Between Models and Reality
mayunak
4
390
Building the Perfect Custom Keyboard
takai
2
840
Making Projects Easy
brettharned
120
6.7k
Transcript
WARUM TYPESCRIPT? JOSHY CYRIAC @IRRWITZ FINEBRAIN.COM
UMFRAGE
ANFANG Java-Land JS-Land
TYPESCRIPT LÖSUNGEN FÜR 2 JS PROBLEME
PROBLEM EINS
module.exports = function extract(data, topic) { … } “article.js”
var article=require(‘article’); var item = require(‘item’); article.extract(data, ‘news’); item.extract(data, 12);
PROBLEM ZWEI
function extract( data, topic ) { … }
None
–from typescriptlang.org “Any browser. Any host. Any OS. Open Source.”
JS TS TS is a TYPED superset of JS
TS Files TS Compiler JS Files
PROBLEM EINS
module.exports = function extract(data, topic) { … } “article.js”
OPTIONAL TYPE SYSTEM
var answer: number = 4; var n: number[] = [1,
2, 3]; var city: string = “Berlin”; enum Color { Red, Green, Blue }; “basic.ts”
var answer = 4; var n = [1, 2, 3];
var city = “Berlin”; var Color; (function (Color) { … } “basic.js”
var foo: any; var foos: any[]; function log(msg): void {
… } var fAdd: (x: number, y: number)=>number; “func.ts”
var foo; var foos; function log(msg) { … } var
fAdd; “func.js”
FIND REFERENCE src/services/extractor.ts function extract(data: Article[], topic: string) src/services/storer.ts ArticleExtractor.extract(data,
defaultTopic)
PROBLEM ZWEI
function extract( data, topic ) { … }
INTERFACES
interface Article { _id: string; url: string; date?: Date; title:
string; text: string; }
function extract( data: Article[], topic: string) { … }
extract(articles, “bar”);“ ✔ extract(“foo”, “bar”); ✗ Argument of type “string”
is not assignable to parameter of type Article[] ^^^^^
MORE STUFF
Type Inference Classes Modules Default parameters Optional parameters Generics Union
Types Intersection Types
INTEGRATING 3RD PARTY LIBS / FRAMEWORKS
DefinitelyTyped
EDITOR SUPPORT
None
MIGRATION
> npm install -g typescript > mv *.js *.ts >
tsc -w -m commonjs server.ts
SUMMARY
PRO CONTRA Optional TYPE SYSTEM Compiles to plain JS Compile
Step ES5/(ES6) compatible
LINKS typescriptlang.org http://basarat.gitbooks.io/typescript/