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
Transcript
8 slides
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: … }) } }
More Decks by katashin
See All by katashin
テストの重要性 / Test is Important
ktsn
0
230
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
510
Contextual ThisType and Vue.js
ktsn
0
13k
大規模静的サイトのためのビルドツール
ktsn
0
2.4k
型付きテンプレートがほしい
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
Web Framework Benchmark Battle 2026, Any%
a_matsuda
3
3.2k
TS 7.0 で baseUrl が使えなくなった今、パスエイリアスをどうするか
bicstone
2
630
まずはコードより業務と向き合う:テーブル解体のためにPdMを呼んだ話
sakawe_ee
0
220
Spec-Driven Development - Why Vaadin Is the Perfect Fit
simas
PRO
0
250
AIが生成したコードは読むべきか?抽象化設計とコードの品質保証 / abstraction-design-and-quality
minodriven
16
9.1k
作れるエンジニアから、価値を届けるエンジニアへ
ryunakayama
1
280
Railsのためのパスキー実践入門 〜マルチテナントSaaSでの意思決定〜
utakaha
4
4.2k
3回つくってわかった、 定期実行ジョブ基盤の本質情報
takai
4
3.9k
Materialが消えた日 〜真っ白なFlutterキャンバスにRenderObjectで絵を描く〜
umigishiaoi
0
160
Goコンパイラを作ってGoをもっと理解する / Build a Go compiler to better understand Go
ikura_hamu
0
130
Zero-Tap Sign-In対応、結局何をすればいいの?
mitohato14
0
2.1k
複数ドメインを一つのアプリに統合するFlutterの設計と運用_FlutterKaigi2026登壇資料(須永高弘)
takahirosunaga
0
180
Featured
See All Featured
Code Review Best Practice
trishagee
74
20k
Fashionably flexible responsive web design (full day workshop)
malarkey
409
67k
Being A Developer After 40
akosma
PRO
92
590k
Reflections from 52 weeks, 52 projects
jeffersonlam
356
22k
GraphQLとの向き合い方2022年版
quramy
50
15k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
33
5.7k
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
610
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
940
Art, The Web, and Tiny UX
lynnandtonic
304
22k
Paper Plane
katiecoart
PRO
6
55k
WENDY [Excerpt]
tessaabrams
15
40k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.7k