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
340
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
tc39 x jsconf.jp Panel Discussion 2024
yosuke_furukawa
PRO
0
150
Removing Corepack
yosuke_furukawa
PRO
9
1.3k
JavaScript Runtime とはなにか
yosuke_furukawa
PRO
15
2.5k
Module Harmony について
yosuke_furukawa
PRO
3
1.5k
LTのやり方
yosuke_furukawa
PRO
16
2.2k
AppRouter Panel Talk
yosuke_furukawa
PRO
3
700
Node.js v22 で変わること
yosuke_furukawa
PRO
13
5.3k
リアーキテクトと開発生産性について
yosuke_furukawa
PRO
25
9.6k
JavaScript Server Runtime History
yosuke_furukawa
PRO
9
3.9k
Other Decks in Programming
See All in Programming
Streams APIとTCPフロー制御 / Web Streams API and TCP flow control
tasshi
2
350
LLM生成文章の精度評価自動化とプロンプトチューニングの効率化について
layerx
PRO
2
190
Why Jakarta EE Matters to Spring - and Vice Versa
ivargrimstad
0
1.1k
アジャイルを支えるテストアーキテクチャ設計/Test Architecting for Agile
goyoki
9
3.3k
【Kaigi on Rails 2024】YOUTRUST スポンサーLT
krpk1900
1
330
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
0
110
subpath importsで始めるモック生活
10tera
0
300
距離関数を極める! / SESSIONS 2024
gam0022
0
280
macOS でできる リアルタイム動画像処理
biacco42
9
2.4k
WebフロントエンドにおけるGraphQL(あるいはバックエンドのAPI)との向き合い方 / #241106_plk_frontend
izumin5210
4
1.4k
TypeScript Graph でコードレビューの心理的障壁を乗り越える
ysk8hori
2
1.1k
Pinia Colada が実現するスマートな非同期処理
naokihaba
4
220
Featured
See All Featured
Typedesign – Prime Four
hannesfritz
40
2.4k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
16
2.1k
No one is an island. Learnings from fostering a developers community.
thoeni
19
3k
Into the Great Unknown - MozCon
thekraken
32
1.5k
Thoughts on Productivity
jonyablonski
67
4.3k
5 minutes of I Can Smell Your CMS
philhawksworth
202
19k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
10
720
The Art of Programming - Codeland 2020
erikaheidi
52
13k
Testing 201, or: Great Expectations
jmmastey
38
7.1k
Designing on Purpose - Digital PM Summit 2013
jponch
115
7k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
A Tale of Four Properties
chriscoyier
156
23k
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 Λ͏ඞཁͳ͍ • ࣗͨͪͷϖʔεͰ͏͜ͱ͕ॏཁͳΜͩ