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
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
andoshin11
March 04, 2020
Technology
340
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Type Safe "Everything"
andoshin11
March 04, 2020
Transcript
37 slides
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?
More Decks by andoshin11
See All by andoshin11
Introduction to gRPC Interceptors
andoshin11
0
140
カーナベルにおけるProtobuf二次利用例
andoshin11
0
190
Envoy External AuthZとgRPC Extensionを利用した「頑張らない」Microservices認証認可基盤
andoshin11
0
1.1k
カーナベル株式会社2024年2月 エンジニアイベント資料
andoshin11
0
600
Private Cloudを支える最高のユーザーガイド運用技術
andoshin11
0
330
TS CompilerがVueを喋れても良いじゃないか
andoshin11
0
840
ain't giving up type-safe Express
andoshin11
2
540
Hack your Nuxt router!
andoshin11
0
1.5k
GatewayパターンとSchema駆動開発
andoshin11
7
1.6k
Other Decks in Technology
See All in Technology
設計手法を「道具」として使いこなすために
a_suenami
5
1.1k
攻撃と守りは何が変わり、何が変わらないのか~最近の不正アクセスから考える、リスク評価と標準の使いどころ
oidfj
2
200
【AWS reInvent 2026 関西組 事前勉強会】二度あることは三度ある~調子に乗りそうな3回目の私を戒めたいです~
ttelltte
0
110
専門家に使ってもらうAIプロダクトをつくる - 病院の医事課向けDPCコーディング支援システムの設計と評価
hagino3000
4
860
高品質と高スピードを支える品質のシフトレフトのアプローチ
goyoki
4
1.7k
ぼくのClaude Codeの使い方
falken
PRO
5
7.6k
閉域網でのAPI公開の選択肢全部比較!
takano0131
4
560
IoTのデータ保存をSREの観点で考える
grimoh
1
110
目を覚ませ!僕らの認証情報が何者かに侵略されてるぞ
tkito
2
470
AWS Client VPNの設定でハマったポイントとその過程での気づき
amarelo_n24
1
400
エンタープライズIAMについて - ID・権限をどう統制するか
oidfj
1
200
AWS Emulator を評価する: 手元で動く AWS の API の仕組み、始め方、確かめ方
inariku
PRO
2
770
Featured
See All Featured
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
35
2.9k
Odyssey Design
rkendrick25
PRO
3
950
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.8k
Heart Work Chapter 1 - Part 1
lfama
PRO
11
37k
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
380
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
670
Into the Great Unknown - MozCon
thekraken
41
2.8k
The SEO identity crisis: Don't let AI make you average
varn
0
630
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
620
What’s in a name? Adding method to the madness
productmarketing
PRO
24
4.2k
Building Flexible Design Systems
yeseniaperezcruz
330
41k
エンジニアに許された特別な時間の終わり
watany
109
250k