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
Strip Types と Storage
Search
Yosuke Furukawa
PRO
August 08, 2024
Programming
4
350
Strip Types と Storage
東京Node学園 43時限目で発表した Strip Types と Storage の話です。
Yosuke Furukawa
PRO
August 08, 2024
Tweet
Share
More Decks by Yosuke Furukawa
See All by Yosuke Furukawa
Welcome JSConf.jp 2024
yosuke_furukawa
PRO
1
3.2k
tc39 x jsconf.jp Panel Discussion 2024
yosuke_furukawa
PRO
0
170
Removing Corepack
yosuke_furukawa
PRO
9
1.3k
JavaScript Runtime とはなにか
yosuke_furukawa
PRO
15
2.5k
Module Harmony について
yosuke_furukawa
PRO
3
1.6k
LTのやり方
yosuke_furukawa
PRO
16
2.2k
AppRouter Panel Talk
yosuke_furukawa
PRO
3
720
Node.js v22 で変わること
yosuke_furukawa
PRO
13
5.4k
リアーキテクトと開発生産性について
yosuke_furukawa
PRO
26
9.8k
Other Decks in Programming
See All in Programming
ドメインイベント増えすぎ問題
h0r15h0
1
230
Go の GC の不得意な部分を克服したい
taiyow
2
770
ゆるやかにgolangci-lintのルールを強くする / Kyoto.go #56
utgwkk
1
370
rails stats で紐解く ANDPAD のイマを支える技術たち
andpad
1
290
これが俺の”自分戦略” プロセスを楽しんでいこう! - Developers CAREER Boost 2024
niftycorp
PRO
0
190
急成長期の品質とスピードを両立するフロントエンド技術基盤
soarteclab
0
930
20年もののレガシープロダクトに 0からPHPStanを入れるまで / phpcon2024
hirobe1999
0
410
今年一番支援させていただいたのは認証系サービスでした
satoshi256kbyte
1
250
Webエンジニア主体のモバイルチームの 生産性を高く保つためにやったこと
igreenwood
0
330
17年周年のWebアプリケーションにTanStack Queryを導入する / Implementing TanStack Query in a 17th Anniversary Web Application
saitolume
0
250
Cloudflare MCP ServerでClaude Desktop からWeb APIを構築
kutakutat
1
540
42 best practices for Symfony, a decade later
tucksaun
1
180
Featured
See All Featured
Writing Fast Ruby
sferik
628
61k
GraphQLの誤解/rethinking-graphql
sonatard
67
10k
Fantastic passwords and where to find them - at NoRuKo
philnash
50
2.9k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
26
1.9k
Bash Introduction
62gerente
608
210k
Why Our Code Smells
bkeepers
PRO
335
57k
Imperfection Machines: The Place of Print at Facebook
scottboms
266
13k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
29
2k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
38
1.9k
How to train your dragon (web standard)
notwaldorf
88
5.7k
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.3k
Java REST API Framework Comparison - PWX 2021
mraible
PRO
28
8.3k
Transcript
strip types ͱ storage Yosuke Furukawa @tng43 2024/8/8
X: @yosuke_furukawa GitHub: yosuke-furukawa
CFP ืूதʂʂʂʂʂ
strip types / storage • Node.js ͷ৽͍͠ػೳ͕2ͭՃ͞Εͨ • strip types
v22.6.0 ~ • storage v22.4.0 ~
strip types • ܕΛιʔείʔυ͔ΒҾ͖ൈ͍ͯ TypeScript ϑΝΠϧΛ JavaScript ϑΝΠϧ ʹมͨ͠͏͑Ͱ࣮ߦ͢Δͱ͍͏ͷ •
͜ΕͰ TypeScript ͷϑΝΠϧΛʢҰఆͷ੍݅Խʹ͓͍ͯʣͦͷ··࣮ ߦͰ͖ΔΑ͏ʹͳͬͨɻ • Ұఆ݅: enum, namespace, decorator ͳͲͷػೳʹؔͯ͠ܕΛऔΓআ͘ ͚ͩͰͳ͘ɺผίʔυΛੜ͢ΔͷͳͷͰ͜͜Ͱαϙʔτର֎
strip types • ͜ͷ݅ʹରͯ͠ͷҰਓࢍ൱ • ࢍ • ૉΒ͍͠ʂʂʂʂ TypeScript ࠷ߴʂʂʂʂ
• ͬͺΓͶɺͦͷ··ಈ͘ͷͬͯྑ͍ΑͶ • Bun, Deno ͱ͔ಉ͡ػೳΛఏڙͯ͠Δ͠ɺ͜ΕͰTypeScriptαϙʔτ Ͱʮ͋Ε͕Ͱ͖ͳ͍ɺ͜Ε͕Ͱ͖ͳ͍ʯͱݴΘΕΔ͜ͱ͕ͳ͍Ͷ
strip types • ͜ͷ݅ʹରͯ͠ͷҰਓࢍ൱ • ൱ • ʮͨͩ͊ʔʔʔʔʔʂʂʂʯ • ʮ͍ɺܕνΣοΫ͕ͳ͍ͷʹTypeScriptαϙʔτͱ͔ݴͬͯྑ͍Θ͚
ແ͍ͩΖʯ • ͪͳΈʹɺtscon f igͱ͔·ͩͳ͍ɻ
strip types • ͜ͷ݅ʹରͯ͠ͷҰਓࢍ൱ • ࢍ • ͍ͰɺDenoBunҰԠstrip͢Δ͚ͩͰ͢Αɻ • Node.jsͦΕ͚ͩͰ͍͍ͷͰʁ
• ※ ݫີʹݴ͏ͱDenoνΣοΫΦϓγϣϯͰͯ͘͠ΕΔ
strip types • ͜ͷ݅ʹରͯ͠ͷҰਓࢍ൱ • ൱ • tscon f ig.json͕αϙʔτ͞Εͳ͍ͬͯɺඍົͳͱ͜ΖͰಈ͔ͳ͔ͬͨΓ͢
ΔͰʁ • ֦ுࢠɺϑΝΠϧύεɻɻɻ • ͋ͱ tsc ͰͷνΣοΫ͕ͳ͍ͷʹ TS αϙʔτͬͯ • ݴͬͪΌ͏ͷݫ͍ͬͯ͠
strip types • uhyo ͞ΜͷεϥΠυͷ͜ͷลΓΛࢀߟʹɻ https://speakerdeck.com/uhyo/tscon f ig-dot-jsonnoshe-ding-wojian-zhi-sou- hurontoendoxiang-ke-2024xia
strip types • TypeScript αϙʔτ͍ͬͯ͏ݴ༿৻ॏʹʂʂʂ // DEMO interface Point {
x: number; y: number; } function logPoint(p: Point) { console.log(`${p.x}, ${p.y}`); } // logs "12, 26" const point = { x: 12, y: 26 }; logPoint(point); // node --experimental-strip-types foo.ts
storage • local storage • session storage • sqlite •
͜ΕΒ͕ೖͬͨ
storage // ͜Μͳͷ͕ಈ͘ localStorage.setItem("foo", 1); console.log(localStorage.getItem("foo")); // node --experimental-webstorage --local-
storage-file="hoge"
storage • ͜ͷ݅ʹରͯ͠ͷҰਓࢍ൱ • ࢍ • ศརͦ͏ʂʂʂʂʂ • ͬͺͶɺbrowserͱͷޓੑΛ্͛ΔͷNode.jsʹͱͬͯॏཁͩΑ Ͷʂʂʂʂ
• ؆୯ʹϑΝΠϧΛอଘͰ͖ΔΑ͏ʹͳΔͷ࠷ߴʂʂ
storage • ͜ͷ݅ʹରͯ͠ͷҰਓࢍ൱ • ൱ • ʮͨͩ͊͋͋͋͋͋ʔʔʔʔʔʂʂʂʂʂʯ • ʮ͍͍͍͍͍ΒͶ͑͑͑͑͑͑͑͑͑͑͑͑͑͑ʂʂʂʂʂʂʯ •
syncͰอଘ͞ΕΔσʔλʹྑ͞Λશ͘ײ͡ͳ͍ • ·ͩasyncʹͳΔͳΒΘ͔ΔɻͰͦΕͳΒશ͘ผͷ֓೦Ͱ AsyncLocalStorage ͱ͍͏API͕͋Γɺ༻ҙ͠Α͏ʹطʹऔΒΕͯΔɻ(※Θ͔Γʹ͍͘ͱࢦఠ͕͋ͬ ͨͨΊه)
storage • ͜ͷ݅ʹରͯ͠ͷҰਓࢍ൱ • ࢍ • ͑ɺͰBunsqlite࠷ॳ͔Βೖͬͯ·͢Α • cloud f
lare workersͱ͔ʹKV Storage͕͋Δ • खܰʹ͑ΔετϨʔδ΄͍͠Ͱ͠ΐʁ
storage • ͜ͷ݅ʹରͯ͠ͷҰਓࢍ൱ • ൱ • खܰʹϑΝΠϧʹอଘͰ͖Δࣄ͕ϒϩοΩϯάͳAPIʹͳΓɺͦΕ͕ ͔ͩͬͨΒNode.jsඇಉظΛத৺ʹൃల͖ͯͨ͠ͷͰͳ͍͔ • localStorageͱ͔͘ɺsessionStorageͷsessionͨͩͷάϩʔόϧ
ϝϞϦͳͷͰɺάϩʔόϧมͱಉٛͰʁϝϞϦϦʔΫʁʁʁ
storage • ҙݟ • ͍ΒͶʔͱࢥ͕ͬͨɺԿχʔζ͕ͳ͍Θ͚Ͱͳ͍ • ಛʹͳΜͱͳ͘࠷ۙखܰετϨʔδͱͯ͠sqliteΛ࠾༻͢ΔྲྀΕ͕૿͑ͯ Δ • ݸਓతʹΘͳ͍͕ɺͦ͏͍͑͜͏͍͏ͷ͋ͬͨͳͱೝ͓ࣝͯ͘͠
ͱɺͳΜ͔͋ͬͨ࣌ʹΤεέʔϓϋονతʹ͑Δ͔͠Εͳ͍
Node.jsʹݶΒͣ • զʑ৽͍༷͠ɺ৽͍͠ػೳ͕ग़ͯ͘Δͨͼʹʮ΄͍͠ʯͱࢥͬͨΓʮ͍ Βͳ͍ʯͱࢥͬͨΓ͢Δ • ༷Ճ͢Δͷ؆୯Ͱɺӡ༻͢Δͷେมɺআ͢Δͷͬͱେม • ͔ͩΒ৻ॏʹͳΔɺࠓՃ͞ΕͯΔͷશ෦ experimental Ͱ͋Δɻ
• Ճ͞Ε͚ͨͩͰ͜Ε͕߃ٱతʹαϙʔτ͞ΕΔͱࢥͬͯΘΕ͗͢ ͪΌ͏͜ͱ • Ұ୴ͬͯΈͯཧղ͢Δʹͳ͍
Node.jsʹݶΒͣ • ͜Εͬͯ Node.js ʹݶΒͳ͍ • ৭Μͳͱ͜ΖͰى͖ͯΔɺwebͦ͏ͩ͠ɺϑϨʔϜϫʔΫͦ͏ɻ • ͜͏͍͏ͷʹৼΓճ͞Εଓ͚ΔͱɹJavaScript Fatigue
ͱݺΕΔɻ
Node.jsʹݶΒͣ • State of JS 2024 ͷ಄ʹॻ͍ͯ͋Δ • ΒͣͬͱϑϨʔϜϫʔΫΤίγεςϜʹৼΓճ͞ΕͯΔ •
ͦΕΛࢦͯ͠ fatigueʢർฐʣ ʹؕΔ͜ͱ͋Δ • ͨͩͦ͏͍͏ early adapter Λ͏ඞཁͳ͍ • ࣗͨͪͷϖʔεͰ͏͜ͱ͕ॏཁͳΜͩ