Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Speaker Deck
PRO
Sign in
Sign up for free
TypeScript+React入門
rchaser53
December 19, 2016
Programming
1
620
TypeScript+React入門
rchaser53
December 19, 2016
Tweet
Share
More Decks by rchaser53
See All by rchaser53
LLVM IR入門
rchaser53
4
1.7k
pitch loaderについて
rchaser53
1
370
Rustからwasmを生成してみた話
rchaser53
1
530
Base64 VLQ概要
rchaser53
2
870
sourcemap規格概要
rchaser53
1
710
Other Decks in Programming
See All in Programming
%q is for Quine
koic
0
400
ちょうぜつ改め21世紀ふつうのソフトウェア設計
tanakahisateru
7
6k
Swift Observation
shiz
3
250
kakutanitalk2022_opening_act
shirotamaki
0
100
監視せなあかんし、五大紙だけにオオカミってな🐺🐺🐺🐺🐺
sadnessojisan
2
1.2k
Enumを自動で網羅的にテストしてみた
estie
0
1.2k
AWSにおける標的型Bot対策
hacomono
0
390
Azure Functionsをサクッと開発、サクッとデプロイ/vscodeconf2023-baba
nina01
1
320
新卒2年目がデータ分析API開発に挑戦【Stapy#88】/data-science-api-begginer
matsuik
0
330
スタック・オーバーフローに コントリビュートしはじめて良かったこと🐣
takuyakikuchi
1
120
Hono v3 - Do Everything, Run Anywhere, But Small, And Faster
yusukebe
4
120
Milestoner
bkuhlmann
1
240
Featured
See All Featured
The Art of Programming - Codeland 2020
erikaheidi
35
11k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
38
3.6k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
270
12k
Infographics Made Easy
chrislema
235
17k
The Cult of Friendly URLs
andyhume
68
5.1k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
318
19k
Music & Morning Musume
bryan
36
4.6k
WebSockets: Embracing the real-time Web
robhawkes
58
6k
How to Ace a Technical Interview
jacobian
270
21k
ParisWeb 2013: Learning to Love: Crash Course in Emotional UX Design
dotmariusz
101
6.2k
The Power of CSS Pseudo Elements
geoffreycrofte
52
4.3k
What’s in a name? Adding method to the madness
productmarketing
12
1.9k
Transcript
TypeScript + React 入門 @rchaser53
伝えたいこと 静的解析があると本当に楽 (TypeScript でもFlow でもOK) ゆるく導入してもメリットはある 少しずつ学んでいく
本日のリポジトリ 取引先のフィールドが淡々と出力されるだけのものです TypeScript で書いた際の雰囲気をお楽しみください https://github.com/rchaser53/TsxDemo
静的解析があると本当に楽 N 番煎じなので静的解析については略 補完や構文エラーが出るのは非常に便利 visual studio code 優秀 ( 好きなeditor
を使いたいならtsserver で頑張ろう)
補完機能は思ったより大事 オブジェクトの構造の把握が容易になる => 新規メンバーや臨時メンバーが入りやすい => リファクタリングもしやすい interface を充実させれば下手なドキュメントより優秀? ( エラーが出るから少なくともメンテはされる)
ゆるく導入してもメリットはある ハードルは日に日に下がっている TypeScript 2 系で設定は大分楽になった TypeScript 2.1.4 でmodule の宣言も不要に
例1. props のinterface だけでも効果あり export interface Props { name: string
label: string index: number } export class Row extends React.Component< Props, {} > { // 略 }
例2. 導入が楽なところから攻める(tsconfig 編) noUnusedLocals 使用していないローカル変数をチェックする noUnusedParameters 使用していない引数をチェックする
例2. 導入が楽なところから攻める( 型編) readonly property を読取り専用にする export interface Circle {
readonly radius: number x: number y: number } let circleA: CirCle = { radius: 10, x: 5, y: 5 } circleA.radiux = 20 // Error! circleA.x = 10 // ok
ハードルが低く効果がわかりやすい所から 体感してもらえないと導入しても使ってくれない 簡単にできて、効果が実感しやすい所から攻める やってくれる人を少しずつ増やしていく
少しずつ学んでいく 一から全部やろうとするから辛い 空いた時間で少しずつ綺麗にしていく ( ファイル、関数、オブジェクト単位で少しずつ) 最初のうちは分かる物だけ使えばよい
わかる機能から始める 非常に多機能。最初から全部は辛い 簡単なものから使っていく 特に既存プロジェクトに一気に導入するのは辛い
皆で一斉にやらなくたっていい 誰かまず始める 空き時間で型を付けたり、interface を宣言したりする (2-3 日に1 回、2-30 分くらいでも十分に効果あり) ある程度ノウハウがたまったら展開していく (
コードレビューあたりを利用)
終わりに 何事もすぐに理想の状態にはならない ちょっとずつ頑張っていく