Save 37% off PRO during our Black Friday Sale! »

そのJavascript、全部TypeScriptにしちゃえ

 そのJavascript、全部TypeScriptにしちゃえ

Open Source Conference 2021 Online/Fall LT

9987516c273a7874b12b742e7aef828f?s=128

Taro Matsuzawa aka. btm

October 23, 2021
Tweet

Transcript

  1. ͦͷJavascriptɺ શ෦TypeScriptʹͪ͠Ό͑ Taro Matsuzawa(@smellman)

  2. ࣗݾ঺հ ஍ཧۭؒܥΤϯδχΞ ೔ຊUNIXϢʔβձձ௕/Ұൠࣾஂ๏ਓOSGeo೔ຊࢧ෦ཧࣄ/Ұൠࣾஂ๏ਓΦʔ ϓϯετϦʔτϚοϓϑΝ΢ϯσʔγϣϯδϟύϯϝϯόʔ ౦ژిػେֶOB/౦ژిػେֶCySecݱ໾ੜ breakcoreΫϥελ ૊௕ͱݺ͹Εͯ·͢

  3. ૊௕ʢ୤ୀࡁΈʣ

  4. OSSͷ׆ಈ React NativeܥϥΠϒϥϦͷվम react-native-static-server (iOSରԠ), redux-persist (ϥΠϒϥϦΛ·Δ͝ͱ TypeScriptʹॻ͖׵͑Δ) ͳͲ OpenMapTilesϓϩδΣΫτ΁ͷߩݙɺ஍ཧؔ܎։ൃ΍຋༁

    ckanext-spatial (Python3ରԠ) ͳͲ ͦͷଞɺؾ͕޲͘··ίʔυ΍υΩϡϝϯτΛॻ͍ͯ·͢
  5. redux-persist ReactͰΑ͘࢖ΘΕΔঢ়ଶͷอ࣋Λ͢Δreduxʹؔ܎͢ΔϥΠϒϥϦ redux-persistΛ࢖͏ͱঢ়ଶΛLocalStorage(Web)/AsyncStorage(React Native)ͳͲʹอ࣋ͯ͘͠ΕΔ εϚϗΞϓϦͰঢ়ଶΛอଘ͢ΔͷʹศརͳϥΠϒϥϦ

  6. ಋೖΛݕ౼ͨ݁͠Ռ ϝϯςφϯε͕2೥͙Β͍์ஔ ϝϯςφʔ͕ډͳ͍ͱ͍͏issue͕์ஔ͞Ε͍ͯΔ Pull Request΋Կ΋͔΋์ஔ ͳΜͱ͔͍ͨ͠

  7. ιʔείʔυΛಡΜͰΈΔ ΢οɺFlow࢖ͬͯΔ…

  8. Flow FLOW IS A STATIC TYPE CHECKER FOR JAVASCRIPT Facebook͕࡞ͬͨJavascriptͷ੩తܕνΣοΧʔ

    Javascriptʹແཧ໼ཧܕͷ֓೦ΛೖΕΔ ΊͬͪΌಡΈͮΒ͍ʼʻ
  9. ܕೖΕΔͳΒ ΋͏TypeScriptͰ͍͍͡ΌΜʂ

  10. ͍͍͡ΌΜ Flow͕·͡ϝϯςφϯεͷ࢓ํ͕Θ͔ΒΜ VSCode͕Flowͷόʔδϣϯ͕ҧ͏ͱΤϥʔΛు͖·͘Δ ͦ͜·ͰͪΌΜͱܕ෇͚͕͞Ε͍ͯΔΘ͚Ͱ΋ͳ͍ ໌ࣔతʹanyͬͯॻ͖͍ͨ͡ΌΜ͔͢

  11. ͱ͍͏Θ͚Ͱ

  12. ΍ͬͨ͜ͱ શ෦TypeScriptԽɺFlowΛ๾໓ Travis CI͔ΒGithub Actions΁ Eslint, rollup, ͦͷଞ΋Ζ΋Ζશ෦ॻ͖௚͠

  13. ͱ͸͍͑ Ϛʔδ͞ΕΔ·Ͱ਺ϲ݄͔͔ͬͨ ཧ༝͸؆୯ɺϝϯςφʔ͕ั·Βͳ͔ͬͨ ઌ೔ɺϝϯςφʔͱίϯλΫτΛऔͬͯมΘΓͷϝϯςφʔ͕ग़ ݱͯ͠΍ͬͱίϝϯτ

  14. ײँ

  15. –ckalika “͜Μʹͪ͸ɺ͋ͳͨͷϓϧϦΫΤετʹ໨Λ௨͢ͷʹ͕͔͔࣌ؒͬͯ͠·͍ɺਃ͠༁͋Γ·ͤΜͰͨ͠ɻࠓɺ ѱҙͷ͋Δ΋ͷ΍ҙຯͷͳ͍΋ͷؚ͕·Ε͍ͯͳ͍͔֬ೝͨ͠ͱ͜ΖͰ͕͢ɺ͜Ε͸...ɻຊ౰ʹײಈ͠·͠ ͨɻcreateAsyncLocalStorage()ʹkeys഑ྻΛ௥Ճͯ͠Ұ؏ੑΛ࣋ͨͤΔͳͲɺࡉ෦ʹ·ͰؾΛ഑ͬͨ ౒ྗʹײँ͠·͢ɻ ࠓͷͱ͜Ζςετ͸͋·Γ͍ͯ͠ͳ͍ͷͰɺ༧૝֎ͷ݁ՌʹͳΔՄೳੑ΋͋Γ·͢ɻ΋ͦ͠͏ͳͬͨΒɺέʔ εόΠέʔεͰରॲ͠·͕͢ɺࢲ͸ؒҧ͍ͳ͋͘ͳͨͷมߋηοτΛਐΊΔ΂͖ͩͱࢥ͍·͢ɻࡉ͔͍मਖ਼ ʢύοέʔδͷόʔδϣϯɺREADME.mdͷߋ৽ͳͲʣΛՃ͍͑ͨͱࢥ͍·͕͢ɺͦΕΒ͕Ͱ͖ͨΒɺتΜ ͰϚʔδ͠·͢ɻ TypeScript΁ͷҠߦͱΠϯϑϥͷۙ୅Խ͸ɺඇৗʹॏཁͰҙٛਂ͍ࣄۀͰ͢ɻ͜ΕʹΑΓɺΑΓҰ؏ੑͷ͋

    ΔɺΑΓଟ͘ͷςετΛߦ͏͜ͱ͕Ͱ͖ΔΑ͏ʹͳΓ·͢ͷͰɺվΊͯײँ͍ͨ͠·͢ɻ”
  16. ۤ࿑͸ใΘΕΔ TypeScriptԽʹΑͬͯΑΓςετ͠΍͘͢ͳͬͨ શମతͳݟ௨͠΋ fl owͰத్൒୺ʹܕΛ͚ͭΔΑΓ΋Θ͔Γ΍͘͢ ͳͬͨ(ओ؍ ͜ΕͰ΍ͬͱଞͷਓ΋ϝϯςφϯεʹՃΘΕΔΑ͏ʹͳͬͨ ͜͜ॏཁͰ͢Αʂ

  17. ·ͱΊ JavascriptͰॻ͔Ε͍ͯΔ΋ͷ͸TypeScriptԽͨ͠ํ͕ྑ͍ྫ΋͋Δ ༐ؾΛͩͯ͠Pull RequestΛग़͢ͷ͕ॏཁ

  18. ͝੩ௌ͋͟·Δਫ࢈