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
TS 未経験者が 社内向け JS ライブラリを TS に置き換えている話
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
pvcresin
November 20, 2019
Technology
440
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
TS 未経験者が 社内向け JS ライブラリを TS に置き換えている話
https://oweb.connpass.com/event/149918/
#OWEB で発表した内容になります。
pvcresin
November 20, 2019
More Decks by pvcresin
See All by pvcresin
プロポーザルを書いてもらう
pvcresin
0
610
関係性から理解する"同一性"の型用語たち
pvcresin
2
740
リセットCSSを1行消したらアクセシビリティが向上した話
pvcresin
4
610
Reduxモダナイズ 〜コードのモダン化を通して、将来のライブラリ移行に備える〜
pvcresin
2
980
text-box-trim について 1 分で
pvcresin
0
170
Web IDEの進化とそれを支える技術
pvcresin
0
150
ステップアップOSSコントリビュート
pvcresin
0
520
Webアプリケーションのアーキテクチャパターンから読み解くNext.js
pvcresin
0
460
Eight WebフロントエンドのDX向上に関する取り組み
pvcresin
0
210
Other Decks in Technology
See All in Technology
『止めない』を設計する — 制約の中で、事業の根幹を支える判断
hiroyaterui
0
240
DEFCON34-Write-up_HYCu-MYCu
daikiokazaki
0
120
日経電子版を支えていく Kasane Design System/fec_fukuoka
nikkei_engineer_recruiting
0
380
GoにおけるFFIのこれまでとこれから
goccy
4
1.7k
GuardDuty 検知対応を DevOps Agent で効率化しようとしている話 / GuardDuty Investigations with DevOps Agent
masahirokawahara
1
340
AI活用の現在地、 ちゃんと見えてますか?/XPfest-2026
visional_engineering_and_design
0
180
AI-DLCって実際どう? 〜聞きたいこと全部聞いてみる〜
news_it_enj
0
250
推論の観測、できていますか? 〜 Google Cloud Gemini Enterprise Agent Platformで 3つの Gemini モデルを実測して踏んだ、評価の罠 〜
shukob
PRO
0
180
振り返りこそエンジニアの本領
negima
0
360
Oracle Cloud Infrastructure IaaS 新機能アップデート 2026/6 - 2026/8
oracle4engineer
PRO
0
130
OpenTelemetry eBPF Instrumentationの舞台裏 / Behind the Scenes of OpenTelemetry eBPF Instrumentation
ymotongpoo
3
740
作品が生態系になった ─ Mini Tokyo 3D から世界へ
nagix
0
150
Featured
See All Featured
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
970
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
300
4 Signs Your Business is Dying
shpigford
187
23k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
320
How GitHub (no longer) Works
holman
316
150k
Color Theory Basics | Prateek | Gurzu
gurzu
0
460
What's in a price? How to price your products and services
michaelherold
247
13k
Six Lessons from altMBA
skipperchong
29
4.5k
The browser strikes back
jonoalderson
0
1.7k
Done Done
chrislema
186
16k
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
230
Transcript
TS 未経験者が 社内向け JS ライブラリを TS に置き換えている話 @pvcresin OWEB #9
鳥山 らいか / Raika Toriyama Sansan 株式会社 Eight 事業部 フロントエンドエンジニア @pvcresin
JavaScript に静的型付けがついた言語 TypeScript とは
• API の定義ファイルをパースし、フロントエンドで使うデータ形式の JS ファイルを自動生成 • 安全で硬い作りにしたい 社内向けライブラリ フロントエンド バックエンド
API の定義ファイル
やったこと
Step1: 学ぶ
• 公式ドキュメント https://www.typescriptlang.org/docs/home.html • Qiita:TypeScript の型入門 https://qiita.com/uhyo/items/e2fdef2d3236b9bfe74a • 記事:がんばらない TypeScript
https://employment.en-japan.com/engineerhub/entry/2019/04/16/103000 • 書籍:実践 TypeScript 吉井 健文 (著) 参考になったもの
Step2: 準備
• 1ファイルずつ置き換えていく • 型チェックと変換には tsc コマンドを採用 導入方法を決める tsc いままで これから
/src /src /compiled /dist /dist
Step3: 置き換え
拡張子でルールを分けるよう変更 ESLint の設定
場所 • よく薦められるのはテストコードから • 今回はライブラリ本体のコードから始めた • テストコードがない部分があった • 本体のコードが何をしているか不明な場所が多かった ファイル
• 外部のライブラリのみ import しているもの • import がないもの • 他のファイルを import しているもの 置き換える順番
• DefinitelyTyped:http://definitelytyped.org/ ◦ @types/<package name> で探す • npm:https://www.npmjs.com/ ◦ 型定義している
package がないか探す • 自分で定義 ◦ デフォルトだと src/@types/*.d.ts 型定義ファイル
導入してよかったこと
• 型安全でない実装がエラーにより可視化された • JS の 暗黙的な型変換 に助けられていた部分が浮き彫りに • 関数がやるべきことに向き合えた •
場合によっては分割 • 命名の再考 • ある種のテスト代わりになった 導入してよかったこと
現状
None
俺たちの戦いはこれからだ