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.7k
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
320
Stage 3 Decorators でできること / できないこと / TSKaigi 2026
susisu
1
2.5k
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.4k
Other Decks in Programming
See All in Programming
The Rails Doctrine Decade
koic
2
450
Simple Storage Service(S3) is not simple
iwatsukayura
0
120
速習iPhone Duo対応
yuukiw00w
2
920
iOS 27でニュースアプリはどう変わる!? 〜日経電子版の新機能対応と、開発事例から〜
lynnswap
7
13k
JAWS-UG 東京支部が始める、JAWS-UG支部コラボ / JAWS-UG lunchtime LT Collaboration
y0hgi
0
170
Turning Architecture into Unit Tests in the AI Era (NSSpain XIV)
steliosf
PRO
1
120
仕様駆動開発による爆速プロダクト開発 / Bakusoku Spec Driven Development
kobakei
0
160
AI時代のコードレビューは人に向けるな、仕組みに向けろ
texmeijin
5
3.2k
Androidだけじゃない、DroidKaigiで広がった私の技術スタック
akkeylab
0
110
Everything will be SERVERLESS — 信じて運用した10年の経験値 / Everything Will be Serverless — Lessons Learned from 10 Years of Operational Experience
seike460
PRO
1
660
Embedded Swiftで作る自作USBデバイス によるiOSデバイスの自動テスト / iOSDC Japan 2026 glassfiber
glassfiber
0
250
そのリトライ、死んだコネクションを使い回していませんか ── GoのHTTPクライアントとHTTP/2を実プロダクト障害から学び直す
myus4a
0
360
Featured
See All Featured
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
2
290
Fireside Chat
paigeccino
43
4k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
2.2k
Highjacked: Video Game Concept Design
rkendrick25
PRO
1
470
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
2.1k
Odyssey Design
rkendrick25
PRO
2
850
How to Talk to Developers About Accessibility
jct
2
560
The SEO identity crisis: Don't let AI make you average
varn
0
570
SERP Conf. Vienna - Web Accessibility: Optimizing for Inclusivity and SEO
sarafernandez
2
1.6k
Ethics towards AI in product and experience design
skipperchong
2
410
So, you think you're a good person
axbom
PRO
2
2.2k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
11
1k
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 に公開版のサーバー実装があります