$30 off During Our Annual Pro Sale. View Details »

TypeScript - road to static (typing) ojisan -

dojineko
December 07, 2017

TypeScript - road to static (typing) ojisan -

dojineko

December 07, 2017
Tweet

More Decks by dojineko

Other Decks in Technology

Transcript

  1. dSPBEUPTUBUJD UZQJOH PKJTBOd !EPKJOFLP(.01FQBCP *OD 5FDI.5( 5ZQF4DSJQU

  2. 5ZQF4DSJQUͰ ੩తܕ෇͚͓͡͞ΜϥΠϑ

  3. ໨࣍ w5ZQF4DSJQUͱ͸ʁ w5ZQF4DSJQUͷίί͕ศར w5ZQF4DSJQUͷͭΒΈ ͱରԠࡦ  wͪΐͬͱͣͭ࢝ΊΔ5ZQF4DSJQU

  4. 5ZQF4DSJQUͱ͸ʁ

  5. 5ZQF4DSJQU w.JDSPTPGUൃͷ੩తܕ෇ͷBMU+4 w+BWB4DSJQUͷεʔύʔηοτͰ͋Γɺ ͢΂ͯͷ+BWB4DSJQU͸༗ޮͳ 5ZQF4DSJQUͱݴ͑Δ wίϯύΠϥͷػೳʹґΔίʔυิ׬ͳ ͲͷΤσΟλࢧԉͰָʹ։ൃ͕Ͱ͖Δ wIUUQTXXXUZQFTDSJQUMBOHPSH

  6. ͳΜͰ5ZQF4DSJQU

  7. ϚωʔδυΫϥ΢υͰͷ࠾༻ཧ༝ w ϚωʔδυΫϥ΢υ͸ϑϩϯταΠυ͔ΒαʔόʔαΠυ·ͰҰ؏ͯ͠
 +BWB4DSJQUͰ࣮૷͞Ε͍ͯΔ w ։ൃ͕ਐΉʹ࿈Εͯ૿͍͑ͯ͘υΩϡϝϯτԽ͞Ε͍ͯͳ͍+BWB4DSJQU w +4%PD +BWB4DSJQUͷυΩϡϝϯτπʔϧ ͸ະಋೖ

    w 5ZQF4DSJQUͷಋೖ࣌͸ςετ͸͜Ε͔Βॻ͍͍ͯ͘ͱ͍͏ϑΣʔζ w ͦ͜Ͱ5ZQF4DSJQUʹΑΔɺ੩తܕ෇͚Λར༻ͨ͠ߏจղੳ΍ɺίʔυิ׬ͳͲͷ ΤσΟλࢧԉػೳΛ׆༻͢Δ w ʮίʔυΛಡΈղ͔ͳͯ͘΋ɺࠓ೔͔Β͸͡ΊΒΕΔ։ൃ؀ڥʯ͕ΰʔϧʂ
  8. ϚωʔδυΫϥ΢υͰͷ࠾༻ཧ༝ w5ZQF4DSJQU͸(PPHMFࣾ಺Ͱར༻Մೳͳݴޠʹ࠾༻͞Εͨ w IUUQXXXQVCMJDLFZKQCMPHHPPHMFUZQFTDSJQUOHDPOG@IUNM w $$ ɺ+BWBɺ+BWB4DSJQUɺ1ZUIPOɺ(Pʹଓ͍ͯͷ࠾༻ w ೥͕͔ΓͰݕ౼ɾݕূΛͯ͠ͷ݁Ռͱͷ͜ͱ wνʔϜ։ൃʹԙ͍ͯɺܕʹΑΔ੍໿͕ίʔυͷ඼࣭ͷ୲อʹɺ


    ͋Δఔ౓༗ޮʹಇ͘ݟࠐΈ͕͋ͬͨ wίϯύΠϧޙͷίʔυ΋ਓ͕ಡΊΔΑ͏ͳܗʹͳ͍ͬͯΔ
  9. ίʔυΛಡΈղ͔ͳͯ͘΋ ࠓ೔͔Β࢝ΊΒΕΔ։ൃ؀ڥ

  10. ܕγεςϜ੩తղੳ ੩తղੳ ඇ࣮ߦ࣌ʹ͓͚Δܕ৘ใΛ͍࣋ͬͯΔͷͰ ͋Δఔ౓͸ςετΛॻ͔ͣͱ΋ίʔυΛ࣮ߦͤͣ ίϯύΠϧ࣌ʹϛεʹؾ͚ͮΔʂ ʜ͕ɺܕʹΑͬͯอূ͞ΕΔͷͰى͜Γʹ͍͘ʂ ؒҧͬͯ΋ίϯύΠϥ͕ࢦఠͯ͘͠ΕΔʂະવʹ๷͕ΕΔʂ w ͏͔ͬΓ਺஋Λظ଴͢Δม਺ʹจࣈྻΛೖΕͨʜ w

    ؔ਺͕ظ଴͍ͯ͠ͳ͍Ҿ਺Λ౉ͨ͠ʜ w ܕ͕֬ఆ͠ͳ͍ঢ়ଶͰࢀরͪ͠Ό࣮ͬͯߦ࣌ʹΤϥʔʜ
  11. ίʔυิ׬ ίʔυิ׬ ίϯύΠϥʹΤσΟλࢧԉػೳ͕͍͓ͭͯΓ ରԠͨ͠ΤσΟλ΍֦ுػೳΛಋೖ͢Δͱ ܕ৘ใΛݩʹೖྗީิΛิ׬ͯ͘͠ΕΔʂ ʜ͕ɺυΩϡϝϯτΛݟͣͱ΋෼͔Δʂ ࢖༻ํ๏·Ͱग़ͯ͘ΔʂλΠϓ਺΋ݮָͬͯͰ͖Δʂ w DMBTT9:;ͬͯԿͷϝιου͕͚͋ͬͨͬʜ w

    ͜ͷϝιουͬͯԿܕ͕ฦͬͯ͘ΔΜ͚ͩͬʜ w ͦ΋ͦ΋Կͯͨ͠Μ͚ͩͬʜ
  12. ੩తܕ෇͚ɾಈతܕ෇͚ w੩తղੳ΍ίʔυิ׬͸ɺ*%&΍ɺ੩తܕ෇͖ݴޠͷίϯύΠϥ͔Β ͢ΔͱׂΓͱҰൠతͳػೳ ʹͳͬͨ  w͔͠͠ͳ͕ΒզΒ͕+BWB4DSJQU͸ಈతܕ෇͖ݴޠͳͷͰ࣮ߦ͢Δ· Ͱܕͷঢ়ଶ͕ෆఆɺ΋͘͠͸ਪ࿦͢Δ͜ͱ͕೉͍͠ w5ZQF4DSJQU͸ಈతܕ෇͖ݴޠͷ+BWB4DSJQUʹܕͷ֙Λணͤͯ੩త ܕ෇͚ͱͨ͠ݴޠ

  13. 5ZQF4DSJQUͷΠϝʔδ 5ZQF4DSJQU͸+BWB4DSJQUͷ֙ ੩తͳܕΛ༩͑Δͱڞʹɺ ศརͳ෢ث΋༩͑ͯ͘ΕΔɻ ੩తղੳɺίʔυิ׬FUDʜ  5ZQF4DSJQU͸֙ͳͷͰ͋͘·Ͱ ࣮ߦ͞ΕΔͷ͸+BWB4DSJQU +4ͷ৺Λ๨Εͯ͸ΠέφΠɻ ݹࣄهʹ΋ͦ͏ॻ͔Ε͍ͯΔ

  14. Generics Interface Abstract Class Async/Await Enum Namespace Decorator Promise ΄͔ʹ΋+4ʹແ͍

    ศརͳػೳ͕ͨ͘͞Μʂ
  15. ଟ͗ͯ͢આ໌͖͠Εͳ͍ͷͰࠓճ͸লུʜ

  16. 5ZQF4DSJQU·ͱΊ w5ZQF4DSJQU͸+BWB4DSJQUΛ੩తܕ෇͚ͰهࡌͰ͖ΔBMU+4ͩΑ wΤσΟλࢧԉػೳ΋͋ͬͯͱͬͯ΋ศརʂ w੩తܕ෇͚ͳͷͰಈతܕ෇͖ݴޠʹ͋Γ͕ͪͳɺ
 ͜·͔ͳϛε΋େ఍͸ίϯύΠϥ͕ࣄલʹࢦఠͯ͘͠ΕΔΑ wଞʹ΋+BWB4DSJQUΛϕʔεʹศརͳػೳ͕୔ࢁ༻ҙ͞ΕͯΔΑ

  17. 5ZQF4DSJQUͷͭΒΈʜ ͱରԠࡦ

  18. ྫܕఆ͕ٛͳ͍

  19. 5ZQF4DSJQUʹԙ͚ΔܕγεςϜ w5ZQF4DSJQU͸੩తܕ෇͚Ͱͳ͍+BWB4DSJQUʹܕΛ࣋ͪࠐΉ࢓૊Έ w༧Ί࢖͍͍ͨ֎෦ϥΠϒϥϦͷܕ͸ఆٛ͞Ε͍ͯΔඞཁ͕͋Δ wK2VFSZ 3FBDU "OHVMBS 7VFKT /PEFͷίΞϥΠϒϥϦ FUDʜ wϝδϟʔͳ΋ͷ͸%FpOJFUMZ5ZQFEͰܕఆ͕ٛఏڙ͞Ε͍ͯΔ

    wϥΠϒϥϦࣗ਎͕ܕఆٛ৘ใΛ͍࣋ͬͯΔ৔߹΋ w5ZQF4DSJQU͸+4%PD͔Β΋ܕ৘ใΛऔΕΔ
  20. OQNͰܕఆٛϑΝΠϧΛ औಘͯ͠࢖͑Δʂ Λ௒͑Δ ϥΠϒϥϦͷܕఆٛΛऩ࿥ ༗ࢤ͕όϯόϯߋ৽ͯ͘͠ΕΔ

  21. Ͱ͸ɺܕఆ͕ٛ୭ʹ΋ఏڙ͞Εͯͳ͍ϥΠϒϥϦΛ࢖͏γʔϯͰ͸ʜʁ

  22. ΋͠ܕఆ͕ٛͳ͔ͬͨΒʁ  wʲύλʔϯʳܕఆٛΛॻ͘ʂ wܕఆٛ͸ಠࣗͰॻ͘͜ͱ΋Ͱ͖ΔͷͰͬ͘͞Γॻ͍ͯ͠·͏ύλʔϯ wOQNͰެ։͞ΕͯΔ΋ͷͷܕఆٛΛॻ͍ͨΒ%FpOJFUMZ5ZQFEʹ
 ϓϧϦΫΤετΛૹΔͱྑ͍ ΋ͪΖΜૹΒͳͯ͘΋0,

  23. ܕఆٛͷແ͍ϥΠϒϥϦͷྫ w จࣈྻ΍਺஋ΛCPPMFBOʹม׵͢ΔZOͱ͍͏ύοέʔδ w ؀ڥม਺ TUSJOH ͔ΒCPPMFBOʹม׵͍ͨ͠ʂ w ͔͠͠ͳ͕Β͜Εʹ͸ܕఆ͕ٛఏڙ͞Ε͍ͯͳ͍ w

    %FpOJFUMZ5ZQFEʹ΋ܕఆ͕ٛͳ͍ w +4%PD΋͍ͭͯͳ͍ ΞϨ͹࢖͑ͨʜ  w ܕఆ͕ٛͳ͍ͷͰ5ZQF4DSJQU্Ͱ
 ม׵݁ՌΛCPPMFBOͱͯ͠ड͚औΕͳ͍ʜ w શ෦BOZܕʹͳΔʜ͔ͳ$
  24. ܕఆٛΛॻ͜͏ʂ

  25. ܕఆٛΛॻ͘Αʂ w ͜ΕͰ5ZQF4DSJQUͰܕΛ࣋ͬͨঢ়ଶͰZOΛ࢖͏͜ͱ͕Ͱ͖Δ w ܕఆٛ͸ύοέʔδͷ͢΂ͯͷ࣮૷Λ໢ཏ͢Δඞཁ͸ͳ͍ lZOzͱ͍͏໊લͷϞδϡʔϧ͕͋Δ͜ͱΛ ఆٛ͢Δ Ϟδϡʔϧ㲈OQNQBDLBHF ZOͱ͍͏ؔ਺͕͋ͬͯɺҾ਺ΛͭऔΓɺ ໭Γ஋͸CPPMFBOͰฦͬͯ͘Δ͜ͱΛ

    ఆٛ͢Δɻ޷ΈͰ+4%PD΋෇͚ΒΕΔɻ ZO͕FYQPSU͞Ε͍ͯΔ͜ͱΛఆٛ͢Δ JNQPSUͨ࣌͜͠ͷؔ਺Λ࢖͑Δͱ͍͏ఆٛ
  26. ܕఆٛΛॻ͍ͨΑʂ ఆٛͨ͠Ҿ਺ͱܕͷ৘ใ͕ิ׬͞ΕΔ Ҿ਺ͷܕͱ߹Θͳ͍৔߹͸ Τϥʔͱͯ͠ݕ஌͞ΕΔΑ͏ʹͳΔ

  27. ΋͠ܕఆ͕ٛͳ͔ͬͨΒʁ  wʲύλʔϯʳBOZܕͰಀ͛੾Δʂ wBOZܕͰ͍͔ͳΔܕ΋ڐ༰ͯͦ͠ͷ෦෼͚ͩ໨ΛᛉΔύλʔϯ w͕࣌ؒͳ͍৔߹ɺܕఆٛΛॻ͘͜ͱʹਫ਼௨ͯ͠ͳ͍৔߹͸༗ޮ

  28. BOZܕͰಀ͛੾Δύλʔϯ ܕ໊ ྫ 4USJOH จࣈྻܕ l)FMMPXPSMEz /VNCFS ਺஋ܕ  #PPMFBO

    ೋ஋ܕ USVF GBMTF "SSBZ5 ഑ྻܕ <lBz lCz lDz>"SSBZTUSJOH /VMM OVMMܕ OVMM "OZ BOZܕ ೚ҙͷܕΛڐ༰͢Δܕ w 5ZQF4DSJQUʹ͸ԼهͷΑ͏ͳܕ͕͋Δ Ұ෦ൈਮ
  29. BOZܕͰಀ͛੾Δύλʔϯ ܕ໊ ྫ 4USJOH จࣈྻܕ l)FMMPXPSMEz /VNCFS ਺஋ܕ  #PPMFBO

    ೋ஋ܕ USVF GBMTF "SSBZ5 ഑ྻܕ <lBz lCz lDz>"SSBZTUSJOH /VMM OVMMܕ OVMM "OZ BOZܕ ೚ҙͷܕΛڐ༰͢Δܕ w 5ZQF4DSJQUʹ͸ԼهͷΑ͏ͳܕ͕͋Δ Ұ෦ൈਮ
  30. BOZܕͰಀ͛੾Δύλʔϯ w BOZܕ͸จࣈ௨ΓͳΜͰ΋͋Γͷܕ จࣈྻͰ΋ɺ਺஋Ͱ΋ɺVOEFpOFEͰ΋  w $$ ͷWPJE ΍(PͷJOUFSGBDF\^ʹ͍ۙ֓೦ w

    ܕఆٛͷແ͍ϥΠϒϥϦ͸·Δ͝ͱBOZܕͱ͢Ε͹ίϯύΠϧΛ௨͢͜ͱ͕Ͱ͖Δ w BOZܕʹͳͬͨ΋ͷ͸ܕͷ੍໿Λ֎ΕΔ w ܕͷ੍໿Λ֎ΕΔͷͰίϯύΠϥʹࢧԉͯ͠΋Β͑ͳ͘ͳΔ w ۭ͍ͨ࣌ؒͰ࢖͏ൣғ͚ͩͰ΋ܕఆٛΛॻ͘ͷ͕͓͢͢Ίʂ
  31. ͪΐͬͱͣͭ͸͡ΊΔ 5ZQF4DSJQU

  32. Ͳ͏΍ͬͯಋೖ͢Δ͔ʁ w5ZQF4DSJQU͕ྑ͍ͷ͸Θ͔͚ͬͨͲͲ͏΍ͬͯಋೖ͢Δͷʁ w ͢ͰʹK2VFSZͰॻ͍ͨίʔυ͕ͨͬ΀Γ͋ΔΜ͚ͩͲʜ w શ෦5ZQF4DSJQUʹ͠ͳ͍ͱͩΊͳΜͰ͠ΐʁ w#BCFM࢖͑ͳ͍ͷʁ w 1SPNJTFͱ͔BTZODBXBJU w

    ௒ڧྗͳ#BCFMϓϥάΠϯ ܕͱ͔Ͳ͏Ͱ΋͍͍͔Β ࣮૷ͤͯ͞ʜ
  33. طଘͷίʔυʹগͮͭ͠ೖΕ͍ͯ͘ w5ZQF4DSJQU͸+BWB4DSJQUͷʮεʔύʔηοτʯ w࿦ཧΤϥʔΛؚ·ͳ͍ݶΓɺ֦ுࢠΛม͑Δ͚ͩͰίϯύΠϧͰ͖Δ w%FpOJFUMZ5ZQFEͰެ։͞Ε͍ͯΔܕఆٛ࢖ͬͯɺ
 ঃʑʹॻ͍͍ͯ͘ͷ͕खܰͰखݎ͍ w ٧·ͬͨΒʮͱΓ͋͑ͣBOZܕΛ࢖ͬͯΈΔʯͱ͍͏΍Γํ΋ΞϦ w5ZQF4DSJQU͔Β+BWB4DSJQUΛJNQPSUͯ͠࢖͏͜ͱ΋Ͱ͖Δ w5ZQF4DSJQUΛͱΓ͋͑ͣೖΕͯΈΔ͚ͩͳΒ͙͢ʹͰ͖Δʂ

  34. +4͔Β54΁ͷҠߦྫ w ΄ͱΜͲॻ͖׵͑ͣʹҠߦ͢Δ͜ͱ͕Ͱ͖ͨ Ұ෦ྫ֎͋Γ  w Ҡߦͷ్தͰEPDVNFOUHFU&MFNFOU#Z*Eͷ݁Ռ͕OVMMʹͳΓ͏Δͱ͍͏
 ߟྀ͕ൈ͚͍ͯΔ͜ͱΛݕ஌ͨ͠ͷͰमਖ਼ͨ͠
 ໭Γ஋͕)5.-&MFNFOUPSOVMMͷͨΊͦͷ··ͩͱίϯύΠϧΤϥʔʹͳΔ

  35. #BCFM͸Ͳ͏͢Δʁ w5ZQF4DSJQUͰ͸࣮ߦ؀ڥΛࢦఆͯ͠ίϯύΠϧ͢Δ͜ͱ͕Ͱ͖Δ w &4&4ɺ&4/FYU&4ͳͲະདྷͷػೳΛݱࡏʹ࣋ͪࠐΊΔ w 1SPNJTFɺ"TZOD"XBJUͳͲͷओཁͳػೳΛτϥϯεύΠϧ͢ΔͨΊʹ
 #BCFMΛಋೖ͍ͯ͠ΔͳΒ5ZQF4DSJQU͸#BCFMͷ্Ґޓ׵ͱͳΓಘΔ w "TZOD"XBJUͷ&4΁ͷίϯύΠϧ͸5ZQF4DSJQUͰରԠࡁΈ w

    ͦͷଞͷ࣍ੈ୅ͷ&$."4DSJQUͷҰ෦ઌߦ࣮૷ͷαϙʔτ΋͞Ε͍ͯΔ ˞#BCFMʜ+4ͷະདྷͷػೳΛݱࡏ͋ΔػೳͰ࠶ݱ͢ΔͨΊͷπʔϧ
 ˞&$."4DSJQUʜ+BWB4DSJQUͷඪ४࢓༷ɻίίͰ͸ʮ͍ΘΏΔ+4ͷ͜ͱʯ͘Β͍ͷೝࣝͰ0,
  36. #BCFM͸Ͳ͏͢Δʁ w#BCFM1PMZpMMͷΑ͏ͳ࣮ߦ؀ڥͷࠩ෼ΛຒΊΔػೳ͸ଘࡏ͠ͳ͍ w ͔͠͠ͳ͕Β#BCFMͱͷซ༻ࣗମ͸Մೳ w ซ༻͢Δͱ5ZQF4DSJQUͷίϯύΠϧͱ#BCFMͷτϥϯεύΠϧͰ
 ഒ͕͔͔࣌ؒΔͷͰ͓͢͢Ί͸͠ͳ͍ w Ͳ͏ͯ͠΋ඞཁͳΒ#BCFM1PMZpMMΛผ్ಡΈࠐΜͰซ༻͢Δͷ͕ྑͦ͞͏ wݴޠػೳΛେ͖͘ม͑ΔΑ͏ͳ#BCFMϓϥάΠϯͷΑ͏ͳػೳ͸ແ͍

    w &$."4DSJQUඪ४ͷ"1*͕ॆ࣮͖͍ͯͯ͠ΔͷͰ੾Γସ͑Λݕ౼͢ΔͳͲ
  37. ͪΐͬͱͣͭ͸͡ΊΔ54·ͱΊ w5ZQF4DSJQU΁ͷҠߦ͸ͦΜͳʹ೉͍͜͠ͱͰ͸ͳ͍Α w +BWB4DSJQUͷεʔύʔηοτͳͷͰߏจ͸্Ґޓ׵ʹͳΔ w ͨ͘͞ΜͷܕఆٛϑΝΠϧ͕ఏڙ͞Ε͍ͯΔ w Ҡߦͯ͠Δ్தͰؾ͖͕ͮ͋Δ͔΋ʁ w#BCFMΛߴ౓ʹ࢖༻͍ͯ͠Δͱ͖͸஫ҙͯ͠Ͷ w

    Ұ෦ͷ৽͍͠ػೳΛ࢖͍͍͚ͨͩͳΒ#BCFM͸ෆཁ͔΋ʁ
  38. ͱ͍͏Θ͚Ͱʜ

  39. ܕγεςϜͰखݎ͍։ൃ ͸͡ΊͯΈ·ͤΜ͔ʁ

  40. ܕ͸͍͍ͧ

  41. ͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠