Upgrade to Pro — share decks privately, control downloads, hide ads and more …

JavaScript製npmパッケージをTypeScriptで書き直した話

 JavaScript製npmパッケージをTypeScriptで書き直した話

https://github.com/watanabeyu/react-native-simple-twitter
https://github.com/watanabeyu/react-native-store-version
この2つをTS化しました的な。
簡単な手順と感想とd.tsについて的な。

Yu Watanabe

April 25, 2019
Tweet

More Decks by Yu Watanabe

Other Decks in Programming

Transcript

  1. ࣗݾ঺հ(1) Θͨͳ΂Ώ͏ ▸ ॴଐ ▸ גࣜձࣾg&h ▸ Web / ΞϓϦΛझຯͰެ։

    ▸ ࢓ࣄ಺༰ ▸ αʔό / ϑϩϯτ / ΞϓϦ / Web ▸ ΞΧ΢ϯτ ▸ Twitter : @hmktsu ▸ Github : @watanabeyu
  2. ࣗݾ঺հ(2) ࣮ફExpo ɾExpo + FirebaseͰInstagram෩ͳΞϓϦΛ࡞ͬͪΌ͓͏తͳຊ ɾ2018೥12݄ʹΠϯϓϨεR&DΑΓग़൛ https://amzn.to/2ruX5DI #1ਓνʔϜຊ ɾExpoͰAPI΋ؚΜͩΞϓϦΛ࡞Δࡍͷ؀ڥߏஙपΓΛத৺ͱͨ͠ຊ ɾͲ͏΍ͬͯίʔυΛ៉ྷʹॻ͔͘ͷTipsͩͬͨΓͱ͔

    ɾCIͷઃఆͱ͔ϦϙδτϦͷ؅ཧͱ͔൒ࣗಈԽͱ͔Dockerͱ͔ ɾ1ਓͰ΋νʔϜ։ൃͱಉ͘͡Β͍ͷ੎͍Ͱ։ൃ͢Δʹ͸తͳ ɾ2019೥04݄։࠵ͷٕज़ॻయ6ʹͯಉਓग़൛ https://hmktsu.booth.pm/items/1315573
  3. ࣗݾ঺հ(3) ▸ https://www.gandh.jp ▸ 3໊(ΤϯδχΞ͸ࣗ෼Ұਓ)Ͱฏۉ೥ྸ30൒͹ͷγχΞձࣾ ▸ ετϦʔτΧϧνϟʔ × ITͳαʔϏεΛӡӦ ▸

    ݱࡏͷϝΠϯࣄۀɿhttps://www.weddyweddy.net ▸ μϯαʔ޲͚ͷϓϥοτϑΥʔϜܥSNSΞϓϦ ▸ ͪ͜ΒͰνϣΠεͨ͠གྷΓ΍͍͢ۂͰགྷͬͯಈըΛΞοϓ react-native + firebase + TypeScriptͰ μϯεͷΦϯϥΠϯϨοεϯΞϓϦΛ։ൃத શ෦JavaScriptͱ͔TypeScriptʹد͍ͤͯ͜͏͔ͱ
  4. JAVASCRIPT -> TYPESCRIPTʹมߋͨ͠ॴײ(1) ▸ ιʔείʔυΛTypeScriptʹมߋ ▸ jsxهड़͞ΕͯΔ.js -> .tsx ▸

    jsxهड़͞Ε͍ͯͳ͍.js -> .ts ▸ ܕΛॻ͍͍ͯ͘ ܕͲ͏͠Α͏ͱ͔೰ΜͩΒany࢖ͬͪΌͬͯ΋Α͍
  5. JAVASCRIPT -> TYPESCRIPTʹมߋͨ͠ॴײ(3) ▸ tsconfig.jsonͷઃఆ ▸ tsc —initͰtsconfig.jsonΛ࡞੒ ▸ ΦϓγϣϯΛࡉʑઃఆ

    ▸ .eslintignoreͱ.gitignoreʹdist/Λ௥Ճ ▸ .npmignoreʹsrcͱtsconfig.jsonΛ௥Ճ ▸ package.jsonͷtypesͱscriptsʹbuildίϚϯυΛ௥Ճ ▸ .circleci/config.ymlʹdeploy͢Δલʹbuild͢ΔίϚϯυΛ௥Ճ npmͱͯ͠ެ։͢Δ৔߹ͱ௨ৗͷΞϓϦ੍࡞ͩͱ tsconfigʹઃఆ͢ΔΦϓγϣϯ͕ҧ͏ؾ͕ͨ͠