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
Go で言うところのアレは TypeScript で言うとコレ / Kyoto.なんか #7
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Susisu
August 23, 2025
Technology
2.8k
7
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Go で言うところのアレは TypeScript で言うとコレ / Kyoto.なんか #7
Kyoto.なんか #7
https://kyoto-nanka.connpass.com/event/365370/
Susisu
August 23, 2025
More Decks by Susisu
See All by Susisu
Stage 3 Decorators でできること / できないこと / TSKaigi 2026
susisu
1
2k
君だけのオリジナル async / await を作ろう / TSKaigi 2025
susisu
20
15k
null or undefined
susisu
25
7.9k
Mackerel のフロントエンドフレームワーク移行 序章 / Hatena Engineer Seminar #13
susisu
0
2.3k
スクリーンショット撮影のために Puppeteer を操る / Kyoto.js 16
susisu
0
980
BuckleScript 使ってみた
susisu
0
430
Atom パッケージ開発のすゝめ
susisu
1
2.3k
5分でわかる Curry–Howard 同型対応
susisu
0
1.3k
ジェネレータを有効活用し隊 / Kyoto.js 11 LT
susisu
2
2.3k
Other Decks in Technology
See All in Technology
AI工学特論: MLOps・継続的評価
asei
4
800
SRENEXT_2026_Chairs__Talks_in_Tamachi.sre.pdf
srenext
1
140
第67回コンピュータビジョン勉強会CVPR2026読会前編
tsukamotokenji
0
160
「顧客の声を聞かなければ何も始まらない」 ── 顧客の声から生まれた『AI返信補助機能』の開発プロセス / AICon2026_shikata_imai
rakus_dev
1
260
凡エンジニアがこの先生きのこるためには。〜TypeScript完全に理解したい〜
alchemy1115
2
410
reFACToring
moznion
0
130
ダッシュボード"開発"について 〜使われるダッシュボードのつくりかた〜
kimichan
0
190
AI時代の開発生産性を捉え直す — 経営と現場をつなぐ「開発組織のオブザーバビリティ」— / AI Dev Ex Conference 2026
tkyowa
1
1.3k
OpenTelemetryにおけるGoのゼロコード・コンパイル時計装について #fukuokago
quiver
0
200
20260720_クラウド女子会×PyLadiesTokyoコラボ Amazon Bedrock ハンズオン用資料
yuuka51
1
110
Alphaモジュール使っていいのかい!?いけないのかい!?どっちなんだいっ!?
watany
1
320
ファミコンでPHPを動かす / PHP on the Famicom
tomzoh
2
600
Featured
See All Featured
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
660
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
730
The Cost Of JavaScript in 2023
addyosmani
55
10k
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
1
2.1k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
Build your cross-platform service in a week with App Engine
jlugia
234
18k
The untapped power of vector embeddings
frankvandijk
2
1.8k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
[SF Ruby Conf 2025] Rails X
palkan
2
1.2k
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
270
Building Flexible Design Systems
yeseniaperezcruz
330
40k
Making Projects Easy
brettharned
120
6.7k
Transcript
id:susisu / 2025-08-23 Kyoto.ͳΜ͔ #7 GoͰݴ͏ͱ͜ΖͷΞϨ TypeScriptͰݴ͏ͱίϨ
None
None
࠷ۙॻ͍ͨTypeScript
࠷ۙॻ͍ͨTypeScriptʢ̍ʣ • ಠཱͳ worker Λෳىಈͯ͠δϣϒΛॲཧͯ͠Β͏ main workerα workerβ workerγ ⋮
δϣϒΛΤϯΩϡʔ
࠷ۙॻ͍ͨTypeScriptʢ̍ʣ • main ͷऴྃ࣌ʹ worker ॲཧதͷδϣϒ͕ऴΘΓ࣍ୈఀࢭͤ͞Δ main workerα workerβ workerγ
⋮ ܬͷޫ SIGTERM
• API αʔόʔ͔ΒͷετϦʔϜΛӬଓԽͭͭ͠ΫϥΠΞϯτʹฦ͢ app server ࠷ۙॻ͍ͨTypeScriptʢ̎ʣ req handler worker API
server DB client ϦΫΤετ ϦΫΤετ ىಈ
• API αʔόʔ͔ΒͷετϦʔϜΛӬଓԽͭͭ͠ΫϥΠΞϯτʹฦ͢ app server ࠷ۙॻ͍ͨTypeScriptʢ̎ʣ req handler worker API
server DB client Ϩεϙϯε Ϩεϙϯε ӬଓԽ Ϩεϙϯε
• ΫϥΠΞϯτ్͕தͰஅ͞ΕͯӬଓԽͳͲͷॲཧଓ͚Δ app server ࠷ۙॻ͍ͨTypeScriptʢ̎ʣ req handler worker API server
DB client X X ӬଓԽ Ϩεϙϯε
app server req handler worker API server DB client X
X ӬଓԽ Ϩεϙϯε main workerα workerβ workerγ ⋮ ܬͷޫ SIGTERM Go͔ʁ
͍͔ʹGoͰॻ͖ͦ͏ • ಠཱͨ͠ worker → goroutine • தஅγάφϧͷ → context
• worker ؒͷσʔλૹड৴ → channel
TypeScriptͰͲ͏͢Δʁ • ಠཱͨ͠ worker → ? • தஅγάφϧͷ → ?
• worker ؒͷσʔλૹड৴ → ?
goroutine • ܰྔεϨου, ฒߦɾฒྻॲཧ go func() { time.Sleep(time.Second) fmt.Println("Pong") }()
fmt.Println("Ping") // Ping // (1s) // Pong
goroutine → async function • ϚϧνεϨου͕ཉ͍͠ͳΒ Web Workers ͳͲ͕ඞཁ͚ͩͲ (async
function() { await setTimeout(1000); console.log("Pong"); })(); console.log("Ping"); // Ping // (1s) // Pong
context • தஅγάφϧͷ ctx, cancel := context.WithCancel(context.Background()) startWorker(ctx) // ...
cancel()
context → AbortController • DOM Standard Ͱఆٛ͞Ε͍ͯΔ AbortController ͕͑Δ const
ac = new AbortController(); startWorker(ac.signal); // ... ac.abort();
context • ϦΫΤετείʔϓͷͷʹΘΕΔ ctx := context.WithValue(context.Background(), "requestId", "c0ffee") handler(ctx) //
handler: ctx.Value("requestId") // = "c0ffee"
context → ? • ୯ʹΦϒδΣΫτΛҾͰ͢ͷ͕جຊ͚ͩͲ... const ctx = { requestId:
"c0ffee" }; handler(ctx); // handler: ctx.requestId; // = "c0ffee"
context → AsyncLocalStorage • ҾΛ͢ͷ͕͍࣌͠ AsyncLocalStorage (ඇඪ४) ͕ศར͔ const storage
= new AsyncLocalStorage<{ requestId: string }>(); const ctx = { requestId: "c0ffee" }; storage.run(ctx, () => { handler(); }); // handler: storage.getStore()?.requestId; // = "c0ffee"
channel • goroutine ؒͷσʔλͷૹड৴ c := make(chan int) go func()
{ for n := 0; n < 10; n++ { c <- n } close(c) }() for n := range c { fmt.Println(n) } // 0, 1, 2, ..., 9
channel → Streams • Streams API ͰࣅͨΑ͏ͳ͜ͱ͕Ͱ͖·͢ const { readable,
writable } = new TransformStream<number, number>(); (async function() { const writer = writable.getWriter(); for (let n = 0; n < 10; n++) { await writer.write(n); } await writer.close(); })(); for await (const n of readable) { console.log(n); } // 0, 1, 2, ..., 9
channel • ͪͳΈʹऴྃΛ͚ͭͩͳΒ c := make(chan struct{}) go func() {
// ... close(c) }() // ... <-c
channel → await • await ͰΑ͍Ͱ͢Ͷ const promise = (async
function() { // ... })(); // ... await promise;
·ͱΊʢ̍ʣ • Go Ͱݴ͏ͱ͜ΖͷΞϨ TypeScript Ͱݴ͏ͱίϨ • goroutine → async
function • context → AbortController, AsyncLocalStorage • channel → Streams ͳͲ
·ͱΊʢ̎ʣ • TypeScript Λॻ͍͍ͯͯৗʹ TypeScript Ͱߟ͍͑ͯΔΘ͚Ͱͳ͍ • ࣮ࡍߟ͍͑͢ݴޠϝϯλϧϞσϧͬͯߟ͍͑ͯΔ • ࠓճͨ·ͨ·
Go ͬΆ͔ͬͨ • ৭ʑ͍ͬͯΔͱศར