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活用 / TypeScript practical use in...
Search
naughtLdy
October 02, 2019
Technology
0
380
メルペイのTypeScript活用 / TypeScript practical use in Merpay
naughtLdy
October 02, 2019
Tweet
Share
More Decks by naughtLdy
See All by naughtLdy
What we do for quality as merpay frontend
naughtldy
0
540
Other Decks in Technology
See All in Technology
歴代のWeb Speed Hackathonの出題から考えるデグレしないパフォーマンス改善
shuta13
6
550
AIが住民向けコンシェルジュに?Amazon Connectと生成AIで実現する自治体AIエージェント!
yuyeah
0
230
Rethinking Incident Response: Context-Aware AI in Practice - Incident Buddy Edition -
rrreeeyyy
0
120
JOAI発表資料 @ 関東kaggler会
joai_committee
1
130
いかにして命令の入れ替わりについて心配するのをやめ、メモリモデルを愛するようになったか(改)
nullpo_head
7
2.7k
AI時代の大規模データ活用とセキュリティ戦略
ken5scal
1
270
[kickflow]20250319_少人数チームでのAutify活用
otouhujej
0
180
20250807 Applied Engineer Open House
sakana_ai
PRO
2
640
Android Studio の 新しいAI機能を試してみよう / Try out the new AI features in Android Studio
yanzm
0
120
Amazon Inspector コードセキュリティで手軽に実現するシフトレフト
maimyyym
0
150
プロダクトエンジニアリングで開発の楽しさを拡張する話
barometrica
0
210
僕たちが「開発しやすさ」を求め 模索し続けたアーキテクチャ #アーキテクチャ勉強会_findy
bengo4com
0
2.6k
Featured
See All Featured
Site-Speed That Sticks
csswizardry
10
780
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
3k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
50k
Agile that works and the tools we love
rasmusluckow
329
21k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3k
Building a Modern Day E-commerce SEO Strategy
aleyda
43
7.4k
Designing for Performance
lara
610
69k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.5k
Scaling GitHub
holman
462
140k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
9
770
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
44
2.4k
Imperfection Machines: The Place of Print at Facebook
scottboms
268
13k
Transcript
メルペイのTypeScript活用 TypeScript meetup #3 2019/10/02 Daiki Sugiura
Daiki Sugiura @naughtLdy • Frontend Engineer • メルペイ CS Tool
None
話すこと • メルペイについて • Nuxt.js + TypeScript • TypeScript活用 /
開発について
メルペイについて
プロダクト パートナー向け C向け •キャンペーン(LP) •クーポン •あと払い •オンライン決済 •加盟店申し込みフォーム •加盟店管理画面 •カスタマーサービス
•加盟店サービス 社内向け
技術スタック Application CI / CD Infra Monitoring
プライベートレジストリ APIClient Validation Rules tsconfig protoc-gen-jsonpb-ts lerna
開発フロー GitHub flow Pull Request Lint / Unit Test Code
Review Approved Build Save Container Image Deploy Container Image Create Container Image
Nuxt.js + TypeScript
Nuxt.js + TypeScript 各プロジェクト共通の機能を package として開発 lerna を使って monorepo にしている
• @merpay/api-client • @merpay/protoc-gen-jsonpb-ts • @merpay/tsconfig-merpay • vuex-typescript-fsa
Nuxt+TypeScriptの事始め NuxtMeetup#2 https://speakerdeck.com/sue71/nuxt-and-typescript
TypeScript活用 / 開発について
TypeScriptで得られるメリット • 人間のうっかりを防いでくれる • Vuex (Store)での型安全 • Component の props
での型安全 • API での型安全
TypeScriptで得られるメリット • 人間のうっかりを防いでくれる • Vuex (Store)での型安全 • Component の props
での型安全 • API での型安全
開発について • エンジニアでAPIの仕様を決める • proto ファイルのレビューを Frontend, Backend 双方からする ◦
全サービスの proto を管理しているリポジトリがあり、プルリクベースでレビューする ◦ proto から README も自動で作成される • proto ファイルを TypeScript に変換して開発する ◦ Frontend は mock API を使用して Backend と平行して開発を進めることができる
protocol buffers メルペイでは API の定義に使用している • gRPC用に API仕様を定義するデータフォーマット • proto
ファイルで API 仕様を定義し、各言語向けに変換して使う • TypeScript に変換することで型安全に開発することが容易になる https://developers.google.com/protocol-buffers/
@merpay/protoc-gen-jsonpb-ts • proto ファイルから TypeScript に変換するライブラリ • Nuxt.js (axios) を使う用に特化している
proto
proto TypeScript
Vuex (Store)
store → vue ここから先の話の補足になる Repository naughtLdy/sandbox-typescript-meetup3 https://github.com/naughtLdy/sandbox-typescript-meetup3
store 定義
store → vue
store → vue any型
store → vue string型
Mapper を作って型がわかるようにする https://github.com/naughtLdy/sandbox-typescript-meetup3/blob/master/src/store/helpers.ts\#L148-L163
store → vue any型 string型
開発について TypeScript の恩恵で • 型安全に Backend とやりとりができる • proto が変更されても気づく仕組みが作れる
ありがとうございました