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
Type Safe "Everything"
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
andoshin11
March 04, 2020
Technology
330
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
130
カーナベルにおけるProtobuf二次利用例
andoshin11
0
180
Envoy External AuthZとgRPC Extensionを利用した「頑張らない」Microservices認証認可基盤
andoshin11
0
1k
カーナベル株式会社2024年2月 エンジニアイベント資料
andoshin11
0
570
Private Cloudを支える最高のユーザーガイド運用技術
andoshin11
0
330
TS CompilerがVueを喋れても良いじゃないか
andoshin11
0
820
ain't giving up type-safe Express
andoshin11
2
520
Hack your Nuxt router!
andoshin11
0
1.5k
GatewayパターンとSchema駆動開発
andoshin11
7
1.6k
Other Decks in Technology
See All in Technology
現場で役立つ技術負債の効果的な返済方法
masuda220
PRO
8
4.2k
GoにおけるFFIのこれまでとこれから
goccy
5
3.6k
beyond jj: config & tools ecosystem
indirect
0
470
AI時代、データエンジニアが一番おもろい
genshun9
0
620
空間オーディオで過去の 自分(ゴースト)と競うランニング 〜HealthKitのルートを足音に変える実装〜
nao_randd
0
220
20260912_スクラムにジェネラリストは必要か
ryugen04
0
420
ADKで始める業務改善 - AIエージェント開発時の考えと設計
harappa80
2
150
安心して変更できるWebフロントエンドの作り方
pirosikick
5
2.6k
30座EKS, 180次升級淬煉的EKS Upgrade Skill 的歷程
eric8230
0
170
登壇の自信を奪う3匹のオバケ / 3 Ghosts That Rob You of Your Confidence in Public Speaking
pauli
9
950
株式会社シーエーシー エンジニア向け会社紹介資料
cac
0
57k
TinyGo 開発サイクルを高速化する:Go で作るエミュレータ入門
zozotech
PRO
1
740
Featured
See All Featured
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
1.9k
Design in an AI World
tapps
1
320
HTML-Aware ERB: The Path to Reactive Rendering @ RubyCon 2026, Rimini, Italy
marcoroth
5
660
A Tale of Four Properties
chriscoyier
163
24k
Paper Plane (Part 1)
katiecoart
PRO
2
11k
Product Roadmaps are Hard
iamctodd
55
13k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
8.3k
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
2
510
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
280
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
28
3.6k
Balancing Empowerment & Direction
lara
6
1.3k
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
420
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?