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
N.E.X.T LEVEL
pluu
2
300
暇に任せてProxmoxコンソール 作ってみました
karugamo
1
710
layerx_20241129.pdf
kyoheig3
2
290
ソフトウェアの振る舞いに着目し 複雑な要件の開発に立ち向かう
rickyban
0
890
クリエイティブコーディングとRuby学習 / Creative Coding and Learning Ruby
chobishiba
0
3.9k
From Translations to Multi Dimension Entities
alexanderschranz
2
130
The rollercoaster of releasing an Android, iOS, and macOS app with Kotlin Multiplatform | droidcon Italy
prof18
0
150
Discord Bot with AI -for English learners-
xin9le
1
120
今年のアップデートで振り返るCDKセキュリティのシフトレフト/2024-cdk-security-shift-left
tomoki10
0
190
短期間での新規プロダクト開発における「コスパの良い」Goのテスト戦略」 / kamakura.go
n3xem
2
160
nekko cloudにおけるProxmox VE利用事例
irumaru
3
420
CSC509 Lecture 14
javiergs
PRO
0
130
Featured
See All Featured
Why You Should Never Use an ORM
jnunemaker
PRO
54
9.1k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
365
25k
Fantastic passwords and where to find them - at NoRuKo
philnash
50
2.9k
Writing Fast Ruby
sferik
628
61k
A Tale of Four Properties
chriscoyier
157
23k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
169
50k
RailsConf 2023
tenderlove
29
940
VelocityConf: Rendering Performance Case Studies
addyosmani
326
24k
The Art of Programming - Codeland 2020
erikaheidi
53
13k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
229
52k
Making the Leap to Tech Lead
cromwellryan
133
9k
How GitHub (no longer) Works
holman
311
140k
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 Λ͏ඞཁͳ͍ • ࣗͨͪͷϖʔεͰ͏͜ͱ͕ॏཁͳΜͩ