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
0
150
Warum TypeScript?
Talk given at bed-con.org in Berlin 2015
Joshy Cyriac
September 18, 2015
Tweet
Share
Other Decks in Programming
See All in Programming
Honoを使ったリモートMCPサーバでAIツールとの連携を加速させる!
tosuri13
1
180
カスタマーサクセス業務を変革したヘルススコアの実現と学び
_hummer0724
0
690
今こそ知るべき耐量子計算機暗号(PQC)入門 / PQC: What You Need to Know Now
mackey0225
3
370
CSC307 Lecture 03
javiergs
PRO
1
490
高速開発のためのコード整理術
sutetotanuki
1
400
Oxlintはいいぞ
yug1224
5
1.3k
AIによる開発の民主化を支える コンテキスト管理のこれまでとこれから
mulyu
3
240
AI前提で考えるiOSアプリのモダナイズ設計
yuukiw00w
0
230
Spinner 軸ズレ現象を調べたらレンダリング深淵に飲まれた #レバテックMeetup
bengo4com
1
230
Implementation Patterns
denyspoltorak
0
280
ぼくの開発環境2026
yuzneri
0
210
CSC307 Lecture 05
javiergs
PRO
0
500
Featured
See All Featured
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
2.7k
Product Roadmaps are Hard
iamctodd
PRO
55
12k
A Modern Web Designer's Workflow
chriscoyier
698
190k
Accessibility Awareness
sabderemane
0
51
The SEO identity crisis: Don't let AI make you average
varn
0
240
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
0
430
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.4k
Claude Code のすすめ
schroneko
67
210k
Mobile First: as difficult as doing things right
swwweet
225
10k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.6k
The #1 spot is gone: here's how to win anyway
tamaranovitovic
2
940
Navigating Weather and Climate Data
rabernat
0
100
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/