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
Welcome JSConf.jp 2024
yosuke_furukawa
PRO
0
3.1k
tc39 x jsconf.jp Panel Discussion 2024
yosuke_furukawa
PRO
0
160
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
25
9.8k
Other Decks in Programming
See All in Programming
As an Engineers, let's build the CRM system via LINE Official Account 2.0
clonn
1
650
CSC509 Lecture 14
javiergs
PRO
0
130
Recoilを剥がしている話
kirik
4
5.7k
事業成長を爆速で進めてきたプロダクトエンジニアたちの成功談・失敗談
nealle
3
1.3k
The rollercoaster of releasing an Android, iOS, and macOS app with Kotlin Multiplatform | droidcon Italy
prof18
0
140
社内活動の取り組み紹介 ~ スリーシェイクでこんな取り組みしてます ~
bells17
0
390
.NET 9アプリをCGIとして レンタルサーバーで動かす
mayuki
1
760
これでLambdaが不要に?!Step FunctionsのJSONata対応について
iwatatomoya
0
470
新規学習のハードルを下げる方法とは?/ How to Make Learning Something New Easier?
nobuoooo
1
140
talk-with-local-llm-with-web-streams-api
kbaba1001
0
160
CSC305 Lecture 26
javiergs
PRO
0
130
Thoughts and experiences on Rust and TypeScript
unvalley
2
220
Featured
See All Featured
Site-Speed That Sticks
csswizardry
1
160
Git: the NoSQL Database
bkeepers
PRO
427
64k
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.3k
How GitHub (no longer) Works
holman
310
140k
Automating Front-end Workflow
addyosmani
1366
200k
Building Your Own Lightsaber
phodgson
103
6.1k
Measuring & Analyzing Core Web Vitals
bluesmoon
4
160
Become a Pro
speakerdeck
PRO
25
5k
Music & Morning Musume
bryan
46
6.2k
Put a Button on it: Removing Barriers to Going Fast.
kastner
59
3.6k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
232
17k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
26
1.8k
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 Λ͏ඞཁͳ͍ • ࣗͨͪͷϖʔεͰ͏͜ͱ͕ॏཁͳΜͩ