Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
TypeScript で型検査器を作る / Implementing a type check...
Search
katashin
June 09, 2017
Programming
22k
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
TypeScript で型検査器を作る / Implementing a type checker with TypeScript
katashin
June 09, 2017
More Decks by katashin
See All by katashin
テストの重要性 / Test is Important
ktsn
0
220
console.animate
ktsn
2
2.8k
Gulp のビルドをもっと効率化するツールを作ってみた / Making a Tool for Optimizing a Build Process of Gulp
ktsn
2
2.6k
ラムダ計算入門 / Introduction of Lambda Calculus
ktsn
0
500
Contextual ThisType and Vue.js
ktsn
0
13k
大規模静的サイトのためのビルドツール
ktsn
0
2.3k
型付きテンプレートがほしい
ktsn
1
44k
Toward Type Safety of Vuex
ktsn
1
1.1k
Vue の TypeScript 事情
ktsn
1
2.6k
Other Decks in Programming
See All in Programming
残高管理から台帳サービスへの進化
artoy
1
210
エージェントを使い続けるためのメタワーク / Meta-work for keeping using the agent
rkaga
6
1.9k
TanStack Vue Query と Pinia Colada から学ぶ非同期状態の型設計
aoshi
0
270
AI主導のプログラミング学習アプリを作ってみた
econanringo
0
190
Web Framework Benchmark Battle 2026, Any%
a_matsuda
3
3k
phperだってパンチカードでコーディングしたい
o0h
PRO
0
450
npm との違いを手がかりにGo の依存管理を理解したい
optim
0
1.1k
dotNET_vulnclicker_intro.pdf
deka_morita
0
150
個人開発者よ、Honoを使え(おじさんver)
tanahiro2010
2
280
Groovy as a human and AI friendly programming language
paulk
0
110
あなたの await、OS まで届いてる? strace で覗く JavaScript の非同期
hasutosasaki
1
1.5k
contenteditable と日本語入力に向き合う
colorful12
0
220
Featured
See All Featured
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
710
Darren the Foodie - Storyboard
khoart
PRO
4
4k
Ten Tips & Tricks for a 🌱 transition
stuffmc
1
270
Building Applications with DynamoDB
mza
96
7.3k
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
3
1.4k
Optimizing for Happiness
mojombo
378
71k
Amusing Abliteration
ianozsvald
1
360
Test your architecture with Archunit
thirion
2
2.5k
First, design no harm
axbom
PRO
2
1.4k
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
280
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.9k
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
1
640
Transcript
5ZQF4DSJQUͰܕݕࠪثΛ࡞Δ ܕษڧձ
ܕݕࠪث w ͋Δܭࢉମܥʹ͓͚Δ߲ͷܕΛಋग़͢Δ w ܕ͚نଇʹͯ·Βͳ͍߲͕ଘࡏ͢Δ࣌ ΤϥʔΛ͛Δ
+BWB4DSJQUͷܕݕࠪثΛ ࡞ͬͯΈΔ w ඞཁʹഭΒΕͨͷͰʜʜ w ߏจ&TQSJNBͱ͔ΛͬͯಘΔ͜ͱ͕Ͱ͖Δ w 5ZQF4DSJQUͷܕใΛదٓ༗ޮ׆༻͢Δ w ؆୯ͷͨΊʹɺ߲෭࡞༻Λ࣋ͨͳ͍ͷͱ͢Δ
"45&YQMPSFS IUUQTBTUFYQMPSFSOFU
ܕ͚نଇͷྫ • true: boolean • t: string ∧ u: U
→ (t + u): string • t: T ∧ u: T → (t === u): boolean • t: { u: U } → t.u: U ˢΛͦͷ··࣮͢Ε0,
είʔϓ w ݱࡏݕ͍ࠪͯ͠Δ߲Ͱར༻ՄೳͳมͷҰཡΛ ͓࣋ͬͯ͘ඞཁ͕͋ΔͷͰɺ function typeOf(ast: ESTree.Node, scope: Var[]): Type
Έ͍ͨͳײ͡ʹͳΔ
ΤϥʔΛूΊΔ w ܕ͚نଇʹͯ·Βͳ͍࣌ʹΤϥʔΛ͛Δ ͷͰͳ͘ɺจ຺ʹΤϥʔΛՃ͢Δ w ϝοηʔδιʔείʔυ্ͷॴΛ༩͢Δͱศར ΤσΟλʔͱ͔ͰઢΛҾ͚Δ
શମ૾ function typeOf(ast: ESTree.Node, scope: Var[]) { switch (ast.type) {
case ‘BinaryOperator’: // … case ‘…’: default: this.errors.push({ message: ‘…’, start: …, end: … }) } }