Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
tsc.rip を支える技術 / Kyoto.なんか #8
Search
Susisu
August 22, 2026
Programming
4.4k
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
tsc.rip を支える技術 / Kyoto.なんか #8
-
Kyoto.なんか #8
-
tsc.rip
Susisu
August 22, 2026
More Decks by Susisu
See All by Susisu
これって Effect でできたのでは? / TSKaigi Mashup Kansai #2
susisu
0
300
Stage 3 Decorators でできること / できないこと / TSKaigi 2026
susisu
1
2.4k
Go で言うところのアレは TypeScript で言うとコレ / Kyoto.なんか #7
susisu
7
2.9k
君だけのオリジナル async / await を作ろう / TSKaigi 2025
susisu
20
16k
null or undefined
susisu
25
8k
Mackerel のフロントエンドフレームワーク移行 序章 / Hatena Engineer Seminar #13
susisu
0
2.3k
スクリーンショット撮影のために Puppeteer を操る / Kyoto.js 16
susisu
0
1k
BuckleScript 使ってみた
susisu
0
440
Atom パッケージ開発のすゝめ
susisu
1
2.3k
Other Decks in Programming
See All in Programming
AIは賢い。でも実行環境は? CLIおじさんがAI時代に伝えたいこと ~ CLIおじさんがAI時代に伝えたいこと ~
curekoshimizu
1
240
Building an Out-of-Order CPU
latte72
1
760
AIを上手に使っていこうとしたら越境せざるを得なくなった話 〜実践1年で見えた境界を越えなければならない理由と進め方〜 / Crossing borders with AI
tomoyakitaura
4
1.1k
思考垂れ流し開発 ~音声入力 × AIエージェント × 開発ハーネスによる試行錯誤~
npostring
0
1.1k
Deep dive into the select statement (GopherCon UK)
jespino
0
180
デプロイ直後のレイテンシスパイクを調べたら、 Railsの仕様にたどり着いた
nhsykym
0
120
DroidKaigi 2026 「個人開発という実験場: Android エンジニアが手にする4つの自由」
slashnephy
0
230
iOSDC Japan 2026 - Swiftで作って学ぼう!データベース自作入門
kaseken
2
140
XHTMLが残したもの
yosuke_furukawa
PRO
2
710
AI × TiDD / 2026.09.05 Redmine 大阪
tokudiro
1
130
Omarchy Tokyo やると聞いて UMPC 買ってセットアップしてきた
mtsmfm
0
140
thread_parallel_with_free-threaded_Python_and_NumPy.pdf
riku_sakamoto
0
300
Featured
See All Featured
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.7k
jQuery: Nuts, Bolts and Bling
dougneiner
66
8.6k
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
230
Embracing the Ebb and Flow
colly
88
5.2k
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
510
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
490
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
720
How to make the Groovebox
asonas
2
2.4k
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
700
A designer walks into a library…
pauljervisheath
211
25k
Site-Speed That Sticks
csswizardry
13
1.5k
Thoughts on Productivity
jonyablonski
76
5.4k
Transcript
tsc.ripを支える技術 id:susisu / 2026-08-22 Kyoto.なんか #8
こんにちは • id:susisu です • 株式会社はてな Webアプリケーションエンジニア/ シニアエンジニア • 文字はデカければデカいほど
良い
tsc.rip • 2026 年 7 月 8 日に TypeScript 7.0
がリリース • コンパイラ (tsc) の実装が TypeScript から Go に移植され高速化 • tsc.rip はこれを記念して作った Web サイト
tsc.rip を支える技術 • AWS 静的サイト 激安 • CloudFront • Lambda
(Function URL) • Go 製 Web サーバー + Lambda Web Adapter
tsc.rip を支える技術 • AWS 静的サイト 激安 • CloudFront S3 で良いのでは?
• Lambda (Function URL) • Go 製 Web サーバー + Lambda Web Adapter
$ curl https://tsc.rip ポ ブラウザと curl でレス ンスが異なる
tsc.rip を支える技術 • AWS 静的サイト 激安 • CloudFront CloudFront Functions
で 向き先の S3 オブジェクトを 変えたら良いのでは? • Lambda (Function URL) • Go 製 Web サーバー + Lambda Web Adapter
$ curl https://tsc.rip/echo \ -XPOST -dHello ディを処理するエンド ポ ボ リクエスト
イントもある
tsc.rip を支える技術 • AWS 静的サイト 激安 • CloudFront 静的??? •
Lambda (Function URL) • Go 製 Web サーバー + Lambda Web Adapter
嘘は一つもない。どういうこと? • AWS 静的サイト 激安 • CloudFront • Lambda (Function
URL) • Go 製 Web サーバー + Lambda Web Adapter
$ curl https://tsc.rip -i X-Type-Instantiations ヘッダ???
嘘は一つもない。どういうこと? • 答え: 型レベル Web アプリケーションだったから。 リクエストのハンドリングは、すなわち「静的検査」だったのだ。
tsc.rip を支える技術 • AWS 静的サイト 激安 • CloudFront • Lambda
(Function URL) 主犯格とみられる人物 • Go 製 Web サーバー + Lambda Web Adapter
tsc.rip を支える技術 (裏) • Go 製 Web サーバー • typescript-go
を組み込み • リクエストを型に変換 → 型を評価 → 型をレス • TypeScript の型で書かれたアプリケーション ポ • export type Handle<Req> = Res; ンスに変換
型を評価する方法 • tsc のコンパイルエラーを見る • Language Server を使う • Compiler
API を使う
tsc のコンパイルエラー • 意図的に型エラーを発生させ、メッセージに含まれる型情報を抽出する • 長い型はデフォルトで省略されるが、--noErrorTruncation オプションで 回避できる • リクエストごとにプロセスを起動するので遅い
• RIP 感はある
Language Server • サブプロセスとして Language Server を起動して通信する • 長い型はデフォルトで省略されるが、オプションで回避できる (らしい)
• 今回は次の Compiler API を使ったので詳細未検討
Compiler API • サーバーにコンパイラ自体をライブラリとして組み込む • TypeScript 実装では API が公開されている •
Go 実装では (少なくとも現時点では) 非公開 (internal 以下) だが、 ハックすると無理やり使うことはできる
Compiler API // server/typeeval/go.mod // github.com/microsoft/typescript-go を自称すると internal 以下も使える module
github.com/microsoft/typescript-go/_tscrip/typeeval // ... require github.com/microsoft/typescript-go v0.0.0-20260708042240-2bd066d87f5b // typescript/v7.0.2 // server/go.mod module github.com/susisu/tsc.rip/server // ... // github.com/microsoft/typescript-go/_tscrip/typeeval は公開なので使える replace github.com/microsoft/typescript-go/_tscrip/typeeval => ./typeeval
Compiler API • Compiler API が使えるようになったが、使い方がわからない • Fable「マカセテ」 • 調査任せてたらなんかプロトタイプできたとか言ってきたので採用
型レベル Web アプリ • アプリ本体はリクエストを引数に取ってレス ンスを返す型エイリアス • export type Handle<Req>
= Res; • ルーティングやヘッダ、 ディの解釈などは基本的に全てアプリ側で実装 • Content-Length の計算など一部 Go 側に任せているものもある ートしていないので実用には向かない ポ ポ ボ • ストリームや副作用はサ
型レベル Web アプリ export type Routes<Req extends req.Request> = {
"/": { GET: (( Req["headers"] extends { accept: infer Accept extends string } ? accept.Negotiate<Accept, ["text/plain", "text/html"]> : "text/plain" ) extends "text/html" ? res.HTML<200, `<!DOCTYPE html>(略)`> : res.Text<200, "The tsc is dead, long live the tsc!\n">) & hs.Link<`<https://susisu.ch>; rel="author"`> & hs.CacheControl<"public, max-age=3600"> & hs.Vary<"accept">; }; // ... };
型レベル Web アプリ export type Handle<Req extends req.Request> = Routes<Req>
extends { [_ in Req["path"]]: infer Handlers } ? Handlers extends { [_ in Req["method"]]: infer Res } ? Res : Req["method"] extends "HEAD" ? Handlers extends { GET: infer Res } ? Res : res.Error<405, "Method Not Allowed\n"> & hs.Allow<AllowedMethods<Handlers>> : res.Error<405, "Method Not Allowed\n"> & hs.Allow<AllowedMethods<Handlers>> : res.Error<404, "Not Found\n">; type AllowedMethods<Handlers> = utils.Join< utils.UnionToTuple<"GET" extends keyof Handlers ? "HEAD" | keyof Handlers : keyof Handlers>, ", " >;
まとめ • tsc.rip の裏では型レベル Web アプリケーションが動いていた • TypeScript 万歳 •
型レベルで Web アプリケーションを書くのはおすすめしません
おまけ • https://github.com/susisu/tsserver に公開版のサーバー実装があります