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
Type Safe "Everything"
Search
andoshin11
March 04, 2020
Technology
300
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Type Safe "Everything"
andoshin11
March 04, 2020
More Decks by andoshin11
See All by andoshin11
Introduction to gRPC Interceptors
andoshin11
0
120
カーナベルにおけるProtobuf二次利用例
andoshin11
0
180
Envoy External AuthZとgRPC Extensionを利用した「頑張らない」Microservices認証認可基盤
andoshin11
0
1k
カーナベル株式会社2024年2月 エンジニアイベント資料
andoshin11
0
540
Private Cloudを支える最高のユーザーガイド運用技術
andoshin11
0
330
TS CompilerがVueを喋れても良いじゃないか
andoshin11
0
810
ain't giving up type-safe Express
andoshin11
2
510
Hack your Nuxt router!
andoshin11
0
1.5k
GatewayパターンとSchema駆動開発
andoshin11
7
1.6k
Other Decks in Technology
See All in Technology
Control Planeで育てるBtoB SaaSの認証基盤 - SRE NEXT 2026
pokohide
1
2.3k
ZOZOTOWNの進化と信頼性を両立する負荷試験
zozotech
PRO
2
160
最適な自走を最小限の支援で — M&Aで拡大する組織で少人数SREが挑んだ1年 / SRE NEXT 2026
genda
0
1.1k
しくみを学んで使いこなそう GitHub Copilot app
torumakabe
2
230
アカウントが増えてからでは遅い? ~ マルチアカウント統制の勘所 ~
kenichinakamura
0
220
kintone の AI コワーカーを、 Anthropic にエージェントを"ホストさせて"作った話 #devkinmeetup
sugimomoto
0
100
AI時代のエンジニアキャリアについて今一度考える
sakamoto_582
2
1.5k
タスクの複雑さでモデルを選ぶ ── Thompson Samplingで動かす“トークン/コスト最適化
satohy0323
0
280
Genie Ontologyは銀の弾丸かを考える / Is Genie Ontology a Silver Bullet?
nttcom
0
240
Empower GenAI with Agile - あなたのアジャイルが生成AIのバフになる仕組み
hageyahhoo
1
180
ボーイスカウトルールでメモリやスキルを改善しよう
azukiazusa1
1
740
Compose 新機能総まとめ / What's New in Jetpack Compose
yanzm
0
160
Featured
See All Featured
A Soul's Torment
seathinner
6
3.1k
Code Reviewing Like a Champion
maltzj
528
40k
Bootstrapping a Software Product
garrettdimon
PRO
307
120k
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.8k
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
310
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.3k
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
590
So, you think you're a good person
axbom
PRO
2
2.1k
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
190
Marketing to machines
jonoalderson
1
5.6k
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
67
56k
Navigating Weather and Climate Data
rabernat
0
310
Transcript
Type Safe “EVERYTHING” @andoshin11 4. 3. 2020 #tsc_api_study
Who am I ? Shin Ando (a.k.a Andy) @andoshin11 -
Freelance Full-Stack Developer - TypeScript / Vue.js / React / Go / Ruby / Flutter / Terraform / etc… - ❤ Code Generation!
• Powerful editor completion • Easy to analyze code base
using AST • Type-level programming • Overall durability • Maintainable • Scalable • F**king AWESOME!! We all love TypeScript, eh? ❤
However...
Not everyone speaks TypeScript (just yet...)
Not everyone speaks TypeScript (just yet...) • Other programming languages
(Go, Ruby, Python, Java, etc...) • Query based languages (a.k.a Database) • Statically defined specs (YAML, CSV, Markdown, Excel) • etc...
Not everyone speaks TypeScript (just yet...) • Other programming languages
(Go, Ruby, Python, Java, etc...) • Query based languages (a.k.a Database) • Statically defined specs (YAML, CSV, Markdown, Excel) • etc...
Solution (we need)
Basic aproach Parser Transformer TS Compiler 1. Parse input and
tokenize into JSON 2. Transform tokens to TypeScript AST 3. Validate AST and emit useful code Outcome
None
Working Projects
① Typing Database Schema (db-recon) • db-recon ( https://github.com/andoshin11/db-recon )
• Generates type-safe db client for Node.js application • Supports MySQL and MSSQL currently
① Typing Database Schema (db-recon)
① Typing Database Schema (db-recon)
① Typing Database Schema (db-recon)
① Typing Database Schema (db-recon) TODO: • Create SQL-to-AST parser
• Get semantic diagnostics for raw SQL literal string ( ts-sql-plugin requires DSL ) • Rewrite ejs templates with TS Compiler API
② Typing API Request/Response (squelette) • squelette ( https://github.com/andoshin11/squelette )
• Generates type definitions for API request/response from Open API spec • Toolchain to build your own type-safe API client
② Typing API Request/Response (squelette)
② Typing API Request/Response (squelette)
② Typing API Request/Response (squelette)
② Typing API Request/Response (squelette)
② Typing API Request/Response (squelette) TODO: • Rewrite remaining ejs
templates with TS Compiler API • Improve parser and AST format
Latest addition
Improving DX for express.js
Remaining Pains...
Remaining Pains... need manual mapping need to define types may
contain typo
Leads to fatal error in future...
What if...
All handlers are typed like a magic ♂
None
Introducing...
typed-oax
Generate express.d.ts from Open API
Generate express.d.ts from Open API
Generate express.d.ts from Open API
DEMO
typed-oax TODO: • Separate handler types by HTTP Method •
Wrap with TS Plugin?