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
as(型アサーション)を書く前にできること
marokanatani
9
2.6k
距離関数を極める! / SESSIONS 2024
gam0022
0
280
OSSで起業してもうすぐ10年 / Open Source Conference 2024 Shimane
furukawayasuto
0
100
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
0
100
Arm移行タイムアタック
qnighy
0
300
Compose 1.7のTextFieldはPOBox Plusで日本語変換できない
tomoya0x00
0
190
카카오페이는 어떻게 수천만 결제를 처리할까? 우아한 결제 분산락 노하우
kakao
PRO
0
110
Amazon Qを使ってIaCを触ろう!
maruto
0
400
受け取る人から提供する人になるということ
little_rubyist
0
230
Flutterを言い訳にしない!アプリの使い心地改善テクニック5選🔥
kno3a87
1
140
OnlineTestConf: Test Automation Friend or Foe
maaretp
0
100
現場で役立つモデリング 超入門
masuda220
PRO
15
3.2k
Featured
See All Featured
Writing Fast Ruby
sferik
627
61k
The World Runs on Bad Software
bkeepers
PRO
65
11k
Bash Introduction
62gerente
608
210k
StorybookのUI Testing Handbookを読んだ
zakiyama
27
5.3k
Scaling GitHub
holman
458
140k
Mobile First: as difficult as doing things right
swwweet
222
8.9k
RailsConf 2023
tenderlove
29
900
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
25
1.8k
How To Stay Up To Date on Web Technology
chriscoyier
788
250k
Facilitating Awesome Meetings
lara
50
6.1k
Fantastic passwords and where to find them - at NoRuKo
philnash
50
2.9k
The Cost Of JavaScript in 2023
addyosmani
45
6.7k
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 Λ͏ඞཁͳ͍ • ࣗͨͪͷϖʔεͰ͏͜ͱ͕ॏཁͳΜͩ