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.8k
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
330
Stage 3 Decorators でできること / できないこと / TSKaigi 2026
susisu
1
2.6k
Go で言うところのアレは TypeScript で言うとコレ / Kyoto.なんか #7
susisu
7
2.9k
君だけのオリジナル async / await を作ろう / TSKaigi 2025
susisu
20
16k
null or undefined
susisu
25
8.1k
Mackerel のフロントエンドフレームワーク移行 序章 / Hatena Engineer Seminar #13
susisu
0
2.3k
スクリーンショット撮影のために Puppeteer を操る / Kyoto.js 16
susisu
0
1k
BuckleScript 使ってみた
susisu
0
450
Atom パッケージ開発のすゝめ
susisu
1
2.4k
Other Decks in Programming
See All in Programming
ジョジョの世界をXRで再現する
mofurune
0
180
SalesForceを内製化!? ~ HR事業を支える顧客管理基盤のインフラを大公開 ~
oku053
0
190
Verilogで学ぶCPU自作入門
uyuki234
8
4.2k
Workers Cache を知る
syumai
0
370
複雑なUIコンポーネントとの ⻑い付き合い⽅:波及するバグからテスト戦略を経て、安全な再設計へ
mixplace
0
450
現場と育てるRailsモデリング 〜Spreadsheetから始めたモデル設計〜
siroemk
2
840
作って学ぶSpring BootのAuto Configuration / JJUG Night Seminar 2026-10-19
rshindo
0
200
Groovy as a human and AI friendly programming language
paulk
0
100
Atomic Design, Enforced: Scaling Mobile Design Systems (next.app devCon / droidCon Berlin 2026)
steliosf
PRO
0
180
ChromeでローカルLLM
ryu1013
0
160
APNsからLive Activityを開始する話
yumnumm
0
170
月間100万人のサービス刷新で、 技術選定をHonoに振り切った話
yutobara
8
6.8k
Featured
See All Featured
Documentation Writing (for coders)
carmenintech
77
5.6k
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
500
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
630
Building the Perfect Custom Keyboard
takai
2
910
Embracing the Ebb and Flow
colly
88
5.2k
How to build a perfect <img>
jonoalderson
1
6.1k
Code Review Best Practice
trishagee
74
20k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.9k
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
2
540
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
2
310
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.9k
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
2
410
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 に公開版のサーバー実装があります