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

TypeScriptは10年でこんなに進化しました / TechFeed Experts Night 11

OKUNOKENTARO
January 18, 2023

TypeScriptは10年でこんなに進化しました / TechFeed Experts Night 11

2023/1/18に発表した資料です。

OKUNOKENTARO

January 18, 2023
Tweet

More Decks by OKUNOKENTARO

Other Decks in Technology

Transcript

  1. 5ZQF4DSJQU͸ ೥Ͱ͜ΜͳʹਐԽ͠· ͨ͠ +BO 5FDI'FFE&YQFSUT/JHIU+BWB4DSJQU5ZQF4DSJQU࠷લઢ !PLVOPLFOUBSP

  2. ୭ w Ԟ໺ݡଠ࿠!PLVOPLFOUBSP w ΫϨε΢ΣΞגࣜձࣾ w 5ZQF4DSJQUྺ೥ w ϑϩϯ τΤϯ

    υ ɾ όοΫΤϯ υ
  3. 5ZQF4DSJQU͸ࡀ w 5ZQF4DSJQU͸೥݄೔ੜ·Ε w ʹύϒϦ οΫͱͳΔ w ʹͯϑΟ ʔ υόοΫΛ΋ͱʹվྑ͠Λ໨ࢦ͢

    w Array͕Array<T>ʹͳΔ w ೥݄೔ʹ͕Ϧ Ϧʔε
  4. 5ZQF4DSJQUY  w %F fi OJUFMZ5ZQFE ʢ༗ࢤίϛϡχςΟʣ ʹͯ 
 ࣍ʑ

    ͱ+4ϥΠ ϒϥ Ϧ༻ͷܕఆٛϑΝΠϧ(.d.ts)͕࡞੒͞ΕΔ w OQNͰ؅ཧ͞Ε͍ͯͳ͍࣌୅ w ܕఆٛґଘղܾπʔϧͱ͍͏ͷ͕ผʹ͋ͬͨ
  5. 5ZQF4DSJQUY  w %F fi OJUFMZ5ZQFEͷܕఆٛϑΝΠϧ͕OQNʹͯ؅ཧ͞ΕΔ w ͍·΍౰ͨΓલ w @types/something͸Πϯε

    τʔϧෆཁͰ಺แ͍ͯ͠Δ͜ͱ͢Β͋Δ w ৽֓೦ͷొ৔ w --strictNullChecks w neverܕ
  6. 5ZQF4DSJQUͷࠎ֨Λ࡞ͬͨ࣌୅ w 5VQMF5ZQFT   w 6OJPO5ZQFT   w

    5ZQF(VBSET   w 4USJOH-JUFSBM5ZQFT   w .BQQFE5ZQFT   w $POEJUJPOBM5ZQFT 
  7. 5ZQF4DSJQUY  w ৽֓೦ͷొ৔ w unknownܕ w Α Γߴ౓ͳܕఆٛͷͨΊͷվྑ w

    Y·Ͱͷ৽ػೳʹର͢Δ֦ு΍վྑ w Α Γݡ͍ܕਪ࿦ͱܕΨʔ υ
  8. IUUQTRJJUBDPNBEWFOUDBMFOEBSPLVOPLFOUBSPUT 5ZQF4DSJQUҰਓΞ υϕϯ τΧϨϯμʔ

  9. 5ZQF4DSJQU  w 5FNQMBUF-JUFSBM5ZQFT w ໘ന͍͜ͱ΍Γ์୊ w ԼهλΠ τϧͰݕࡧ wʰ5ZQF4DSJQUܕύζϧͰ࡞ΔNJOJJOUFSQSFUFSʱ

     wʰ5ZQF4DSJQUͷܕఆٛͰຑ੃ͷ໾൑ఆΛ͢Δʱ
  10. 5ZQF4DSJQU w 3FDVSTJWF$POEJUJPOBM5ZQFT w $POEJUJPOBM5ZQFTͷܕܾఆॲཧ͕࠶ؼՄೳʹͳͬͨ w ΧϨϯμʔ ʰ࣮ྫRecursivePartial<T>ʱ ʹͯ঺հ 


    IUUQT[FOOEFWPLVOPLFOUBSPBSUJDMFTHNQLQH[CHLINCLBQDL
  11. 5ZQF4DSJQU  w --useUnknownInCatchVariables w DBUDIϒϩοΫͰͷFSSม਺͕σϑΥϧ τͰunknownܕѻ͍͞ΕΔΑ ͏ʹͳͬͨ w ·Ͱ͸anyܕ

    w Ҏ߱ɺ ΦϓγϣφϧͰunknownܕʹมߋ
  12. 5ZQF4DSJQU  w /PEFKTʹ͓͚Δ&4.PEVMFʹରԠ͢ΔͨΊͷίϯύΠϧ ɾ Φϓγϣϯ௥Ճ w ͔Βʹ͔͚ͯ$+4 &4.ؔ࿈ͷରԠΛॆ࣮ wʰ5ZQF4DSJQUͱ/BUJWF/PEFKT&4.ʱ

    ʹৄ͍͠ 
 IUUQTRVSBNZNFEJVNDPNUZQFTDSJQU&"OBUJWFOPEFKTFTNBCB
  13. 5ZQF4DSJQU  w satisfies0QFSBUPS w ٱʑʹ৽֓೦ w ຊ೔ͷࣛ໺૖͞Μͷ ʰ5ZQF4DSJQUͷBTDPOTUTBUJT fi

    FT͕ศརʱ ͕ৄ͍͠
  14. ਐԽͷ܏޲ w 5ZQF4DSJQU͔Β·Ͱ͸ౖ౭ͷਐԽͩͬͨ w ೔ʑมΘΔۀ຿্ͰͷςΫχοΫ w ػೳ௥Ճͷͨͼʹ ʮ͋Ε͸Ͳ͜Ͱ࢖͑Δʯ Λߟ͍͑ͯ͘ w

    Ҏ߱͸Ұൠతͳ։ൃۀ຿Λ͜ͳ͢ݶΓͰ͸ɺ ͔ͳΓΏΔ΍͔ͳਐԽ w ΏΔ΍͔͚ͩͲ͔Ώ͍ͱ͜Ζʹख͕ಧ͘ਐԽ͕૿͑ͨ w ܕఆٛ࡞੒ऀʹͱͬͯ͸ ʮ଴ͬͯ·ͨ͠ʯ ͳػೳ௥Ճ͕ଟ͍͕ 
 ਺όʔδϣϯ͘ Β͍ͳΒΩϟονΞοϓ͕஗Εͯ΋େৎ෉ ʂ  w ஌͓ͬͯ͘ ͱ ʮۀ຿্Ͱͪΐͬͱॿ͔Δʯ ͷස౓͕૿͑ͯ͘ Δ͔΋
  15. ֶशํ๏ͷεεϝ w 5ZQF4DSJQUॳֶऀʹ͸ઐ໳ॻͱ౰ํͷΞ υϕϯ τΧϨϯμʔ ̎ ̑ هࣄΛΦεεϝ w ઐ໳ॻˠ໢ཏతʹ֬ೝͰ͖Δ

    w Ξ υϕϯ τΧϨϯμʔˠۀ຿্Ͱͷ޻෉Λ๛෋ʹ঺հ w ࠓޙͲ͏ ͍ͯ͘͠ ͱΑ͍͔ ʁ  w 5ZQF4DSJQUࣗମͷΩϟονΞοϓ͸͢Δͱͯ͠ɺ Ή͠Ζपลࣄ৘ʹڵຯΛ΋ͭ͜ͱΛΦεεϝ w %FOPͱ͸ ʁ #VOͱ͸ ʁ &4ͱ͸ ʁ 5$ͱ͸ ʁ  w Ϟδϡʔϧࣄ৘͸ ʁ  $+4 &4. όϯ υϧࣄ৘͸ ʁ ʢ5VSCP 7JUFͳͲʣ
  16. 5IBOLZPV