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 in Wantedly
Search
Kento Moriwaki
May 29, 2018
2
660
TypeScript in Wantedly
Kento Moriwaki
May 29, 2018
Tweet
Share
More Decks by Kento Moriwaki
See All by Kento Moriwaki
わかった気になれる CRDT を使った共同編集
kentomoriwaki
5
3.6k
デザインシステムを導入してUIに秩序を取り戻す - React (Native)編 #rejectron2018
kentomoriwaki
16
3.5k
ReactでWebとNativeの共通UIライブラリを作ろう
kentomoriwaki
0
1.1k
BFFを導入しなかった理由
kentomoriwaki
4
13k
5分でわかる React "Suspense"
kentomoriwaki
3
1.4k
導入して1年経ったReact周辺の 技術スタックを反省します | React反省会@Wantedly
kentomoriwaki
10
8.5k
Immutable.jsとReact @Wantedly ~入門編~
kentomoriwaki
8
74k
React速習会@Wantedly
kentomoriwaki
1
400
Featured
See All Featured
4 Signs Your Business is Dying
shpigford
180
21k
Being A Developer After 40
akosma
86
590k
Fireside Chat
paigeccino
32
3k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
27
4.2k
Keith and Marios Guide to Fast Websites
keithpitt
408
22k
Visualization
eitanlees
144
15k
Facilitating Awesome Meetings
lara
49
6k
Designing for Performance
lara
604
68k
The Language of Interfaces
destraynor
154
24k
Building Better People: How to give real-time feedback that sticks.
wjessup
363
19k
jQuery: Nuts, Bolts and Bling
dougneiner
61
7.5k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
504
140k
Transcript
©2018 Wantedly, Inc. TypeScript in Wantedly Roppongi.js#3 29.May.2018 - Kento
Moriwaki
©2018 Wantedly, Inc. 5ZQF4DSJQUಋೖ͠·ͨ͠
©2018 Wantedly, Inc. 8BOUFEMZͷձࣾϖʔδͷ ϦχϡʔΞϧͨ͠ 443Λಋೖ͢Δඞཁ͕͋Γɺ શମͷߏΛݟͨ͠
ͱͱܕ͕΄͍͠ଟ͔ͬ ͨͷͰɺ͍͍λΠϛϯάͩͱ ࢥ͍ಋೖͨ͠ എܠ
©2018 Wantedly, Inc. ೖΕͯΑ͔ͬͨ
©2018 Wantedly, Inc. ҆৺ͯ͠ίʔυΛมߋͰ͖Δ w 4UPSFͷߏΛม͑ͨΓͨ͠ͱ͖ɺมߋ͖͢Օॴ͕͙͢ʹΘ͔Δ ิ͕ޮ͘ w
λΠϐϯάݮΔ͠ɺ5ZQPݮΔ Τϥʔ͕ݮΔ w VOEFpOFEΤϥʔ͕΄΅ແ͘ͳΔ Α͔ͬͨͱ͜Ζ
©2018 Wantedly, Inc. ͜͏ͬͯಋೖ͠·ͨ͠
©2018 Wantedly, Inc. AUTDAͰϏϧυ͠ͳ͍
©2018 Wantedly, Inc. ϏϧυपΓΓΊΜͲ͍͘͞ w XFCQBDLʹMPBEFSΛՃͯ͠ɺͦΕΛ443༻ͷϏϧυมߋͯ͠ɺKFTUͰUTΛϏϧυ͢Δํ ๏ΛௐͯɻɻઃఆपΓΓΊΜͲ͍͘͞ɻ ݁ہCBCFMඞཁ w QPMZpMMೖΕͨΓɺSFBDUIPUMPBEFSͷϓϥάΠϯɺTUZMFEDPNQPOFOUTͷ࠷దԽͨ͠Γɺ
5ZQF4DSJQUͷϏϧυ݁ՌΛCBCFMʹ͔͚Δඞཁ͕Ͳ͏ͯ͠ग़ͯ͘Δɻ `tsc`ͰϏϧυ͠ͳ͍
©2018 Wantedly, Inc. !CBCFMQSFTFUUZQFTDSJQU w CBCFMͷUSBOTGPSNͰɺ5ZQF4DSJQUͷγϯλοΫεΛআͯ͘͠ΕΔૉΒ͍ͭ͠ w IUUQTHJUIVCDPNCBCFMCBCFMUSFFNBTUFSQBDLBHFTCBCFMQSFTFUUZQFTDSJQU Δ͜ͱCBCFMSDʹҰߦՃ͑Δ͚ͩ w
QSFTFUT<!CBCFMQSFTFUUZQFTDSJQU> w XFCQBDLͷมߋ͍Βͳ͍ɺKFTUͦͷ··ಈ͘ ࣮ɺbabel͚ͩͰTypeScriptͷϏϧυ͕Ͱ͖Δ
©2018 Wantedly, Inc. CBCFM CFUB ͔Β͑Δ w Ҏ্CFUBͷ։ൃ͕ଓ͍͍ͯΔ w CFUB·ͰਐΜͰ͍Δ͚Ͳ
શͳޓੑ࣋ͨͳ͍ w جຊతʹɺ5ZQF4DSJQUͷίʔυ͔ΒܕΞϊςʔγϣϯΛআ͍ͯ͠Δ͚ͩ w AOBNFTQBDFA ADPOTUFOVNAͳͲͷػೳ͕͑ͳ͍ w XPSLBSPVOEͪΌΜͱ͋Δ w AOVNCFSAͳͲͷΩϟετͰͰ͖ͳ͍ w +49ͱͷ۠ผ͕Ͱ͖ͳ͍ʁABTOVNCFSAΛ͍͍͑ ҙ
©2018 Wantedly, Inc. AUTDOP&NJUAͰܕνΣοΫͷΈߦ͏ w MJOUFSͳͲͱಉ͡Ϩϕϧͷѻ͍ w ܕΤϥʔ͕͋Δͱ$*͕ͪΌΜͱམͪΔΑ͏ʹ͢Δ w ։ൃதܕ͕ؒҧ͍ͬͯͯɺϏϧυͪΌΜͱͰ͖Δ
TypeScriptܕνΣοΫͷΈ
©2018 Wantedly, Inc. UZQFTDSJQUGTB
©2018 Wantedly, Inc. 3FEVYͷBDUJPO SFEVDFSपΓͲ͏ॻ͍ͨΒ͍͍ͷ ͔ϕετϓϥΫςΟε͕Θ͔Βͳ͍ w ௐͨΒ͍ΖΜͳॻ͖ํ͕ग़ͯ͘Δ w 3FEVYWͰܕఆ͕ٛΑ͘ͳΔΒ͍͠
࣌ w ͭ·ΓࠓΑ͘ͳ͍ͷ͔ͳʁ w W͢ͰʹϦϦʔεࡁΈͰ͕͢Ͳ͏มΘͬͨͷ͔Βͳ͍ w Ϩʔϧ͕ཉ͍͠ʂ typescript-fsa
©2018 Wantedly, Inc. ͦΜͳͱ͖ʹग़ձͬͨͷ͕ɺ5ZQF4DSJQU'4"Ͱ͠ ͨ w IUUQTHJUIVCDPNBJLPWFOUZQFTDSJQUGTB w "DUJPO$SFBUPSMJCSBSZGPS5ZQF4DSJQU'4"DPNQMJBOU w
͘͢͝ബ͍6UJMJUZ w GBNJMZ͕͍͔ͭ͋͘Δ w UZQFTDSJQUGTBSFEVDFST w UZQFTDSJQUGTBSFEVYUIVOL w UZQFTDSJQUGTBSFEVYTBHB typescript-fsa
©2018 Wantedly, Inc. redux-actionsͱࣅ͍ͯΔ
©2018 Wantedly, Inc. ඇಉظͳActionͷఆٛ ։࢝ɺऴྃɺࣦഊͷΞΫγϣϯΛಉ࣌ʹ࡞ͬͯ ͘ΕΔ
©2018 Wantedly, Inc. typescript-fsa-reducers SFEVDFSؔʹɺDBTFͱ͍͏ϝιου͕ ੜ͑ɺTXJUDIจͷΘΓʹͦΕΛ͏ ୈҰҾʹGTBΞΫγϣϯΛ͠ɺୈೋҾ ʹͦͷ߹ͷSFEVDFSॲཧΛ͔͘ɻ͜ ͷҾ͕͖ͪΜͱܕ͕ܾ·ͬͨͷ͕ͬ ͯ͘Δ
©2018 Wantedly, Inc. typescript-fsa-redux-thunk CJOE5IVOL"DUJPOͰɺඇಉظͳ"DUJPOΛғͬͯॲཧΛ࣮͢Δ ฦΓ͕݁ՌͷQBZMPBEʹͳΔɺEJTQBUDIͷ݁ՌΛJT'BJMVSF JT4VDDFTTͰධՁ͢Δ
©2018 Wantedly, Inc. w GTBܗࣜͰ"1*ϦΫΤετΛఆٛͰ͖Δ request-creator(internal)
©2018 Wantedly, Inc. $PNQPOFOUͷܕఆٛ
©2018 Wantedly, Inc. ίϯϙʔωϯτ͝ͱʹຖճܕఆٛΛॻ͘ͷΊΜͲ ͍͘͞ w ΄΅ಉ͡Α͏ͳQSPQTΛड͚͍ͯΔ߹ɺ͍·Θ͍ͨ͠ w ྫ͑$PNQBOZ͕͋ͬͨΒɺͲͷϑΟʔϧυ͕ඞཁ͔ίϯϙʔωϯτʹΑΔ͕ɺͲ͏͍͏ ܕͳͷ͔ڞ௨ͷͣ
ܕఆٛΛ؆୯ʹॻ͖͍ͨ
©2018 Wantedly, Inc. WtdModels υϝΠϯͰڞ௨ͳ&OUJUZΛఆ͍ٛͯ͘͠ "1*ɺ3BJMTͷBDUJWFNPEFMTFSJBMJ[FST ʹґଘ͍ͯ͠ΔͷͰɺ֤4FSJBMJ[FSʹରԠ ͨ͠ܕΛఆٛ͢Δ
©2018 Wantedly, Inc. WtdModels.Partial υϝΠϯͰڞ௨ͳ&OUJUZΛͱʹɺͦ ͷ$PNQPOFOUͰඞཁͳϑΟʔϧυΛ 8UE.PEFMT1BSUJBMΛͬͯએݴ͢Δɻ \$PNQPOFOU^.PEFMTͱ͍͏໊લʹͦͷ ܕΛ͓͍ͯɺίϯϙʔωϯτͱҰॹʹ FYQPSU͢Δϧʔϧ
©2018 Wantedly, Inc. WtdModels.Union ෳͷ$PNQPOFOUΛΈ߹Θͤͨ $PNQPOFOUͰɺͦΕͧΕͷ \$PNQPOFOU^.PEFMTͷఆٛΛ A8UE.PEFMT6OJPOAͰ݁߹ͯ͠ܕఆٛ͢ Δɻ தɺجຊతʹAA͍ͯ͠Δ͚ͩɻ
©2018 Wantedly, Inc. ·ͱΊ
©2018 Wantedly, Inc. 5ZQF4DSJQUੜ࢈ੑߴ͍ #BCFMΛ͑ઃఆָ UZQFTDSJQUGTB͕͓͢͢Ί
ܕఆָ͕ٛʹ͔͚ΔΑ͏ʹ͍ͯ͜͠͏ ·ͱΊ
©2018 Wantedly, Inc. ࠷ޙʹ we are hiring! https://www.wantedly.com/projects/59809