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
TypeScript で型検査器を作る / Implementing a type check...
Search
katashin
June 09, 2017
Programming
0
22k
TypeScript で型検査器を作る / Implementing a type checker with TypeScript
katashin
June 09, 2017
Tweet
Share
More Decks by katashin
See All by katashin
テストの重要性 / Test is Important
ktsn
0
180
console.animate
ktsn
2
2.5k
Gulp のビルドをもっと効率化するツールを作ってみた / Making a Tool for Optimizing a Build Process of Gulp
ktsn
2
2.1k
ラムダ計算入門 / Introduction of Lambda Calculus
ktsn
0
270
Contextual ThisType and Vue.js
ktsn
0
13k
大規模静的サイトのためのビルドツール
ktsn
0
2.2k
型付きテンプレートがほしい
ktsn
1
44k
Toward Type Safety of Vuex
ktsn
1
960
Vue の TypeScript 事情
ktsn
1
2.6k
Other Decks in Programming
See All in Programming
ドメイン駆動設計を実践するために必要なもの
bikisuke
4
330
Go Code Generation at newmo / 2024-08-27 #newmo_layerx_go
genkey6
0
560
Rubyのobject_id
qnighy
6
1.3k
Scala アプリケーションのビルドを改善してデプロイ時間を 1/4 にした話 | How I improved the build of my Scala application and reduced deployment time by 4x
nomadblacky
1
180
Jakarta EE meets AI
ivargrimstad
0
380
GenU導入でCDKに初挑戦し、悪戦苦闘した話
hideg
0
160
状態管理ライブラリZustandの導入から運用まで
k1tikurisu
3
470
LangChainの現在とv0.3にむけて
os1ma
4
910
LangGraphでのHuman-in-the-Loopの実装
os1ma
3
1.1k
Go1.23で入った errorsパッケージの小さなアプデ
kuro_kurorrr
2
390
REXML改善のその後
naitoh
0
190
Swiftコードバトル必勝法
toshi0383
0
150
Featured
See All Featured
Robots, Beer and Maslow
schacon
PRO
157
8.2k
Designing with Data
zakiwarfel
98
5k
Debugging Ruby Performance
tmm1
72
12k
Imperfection Machines: The Place of Print at Facebook
scottboms
263
13k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
166
48k
Facilitating Awesome Meetings
lara
49
5.9k
Faster Mobile Websites
deanohume
304
30k
jQuery: Nuts, Bolts and Bling
dougneiner
61
7.4k
Keith and Marios Guide to Fast Websites
keithpitt
408
22k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
248
20k
Web development in the modern age
philhawksworth
204
10k
Navigating Team Friction
lara
183
13k
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: … }) } }