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
ポケモンの型をTypeScriptの型システムで表現してみた
Search
subroh_0508
June 10, 2026
Technology
470
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
ポケモンの型をTypeScriptの型システムで表現してみた
TSKaigi Night talks 〜after conference〜 のLT資料です
https://findy.connpass.com/event/392420/
subroh_0508
June 10, 2026
More Decks by subroh_0508
See All by subroh_0508
個人の生産性は青天井、そんな時代のエンジニアはチームに何をなすべきか
subroh0508
0
61
非定型なドキュメントを効率よくリファクタする 〜えぇ!?仕様書27本の移行が1日で終わったって!?〜
subroh0508
3
1.3k
Pull Request、AIレビューだけでマージしてOK?
subroh0508
1
95
ぼっちではじめた登壇が「51名」「241件」の発信に化けた
subroh0508
1
590
"スキルファースト"で作る、AIの自走環境
subroh0508
2
980
AIを賢くしたいなら、まずは人間の改善ループから
subroh0508
0
250
"S/N-GUL4R1TY"に向けて人類は何をすべきなのか
subroh0508
0
73
画面の向こうから「気づき」を得る 画面の向こうを「物差し」として捉える
subroh0508
1
420
蓮ノ空女学院スクールアイドルクラブはなぜ強いのか
subroh0508
0
110
Other Decks in Technology
See All in Technology
【CEDEC2026】『GRANBLUE FANTASY: Relink - Endless Ragnarok』のバトル制作事例 ~最高のキャラゲーを目指して~
cygames
PRO
0
290
つくって納得、つかって実感! 大規模言語モデルことはじめ ver2.0
recruitengineers
PRO
4
1.6k
MIRU 2026 チュートリアル
keisuke198619
0
910
モノリス Rails でも日中に rails db:migrate を走らせたい! / Daytime rails db:migrate on Monolithic Rails!
euglena1215
4
580
まちスペース®とデジタルツインと「まちづくり」
hiro_ogi
0
110
Sansan Engineering Unit 紹介資料
sansan33
PRO
1
4.9k
攻撃と防御で学ぶAI時代のプロダクトセキュリティ演習
recruitengineers
PRO
9
2.7k
Bits Agent Builder の⼊⾨と活⽤事例
nulabinc
PRO
0
140
第3回しろおびセキュリティスポンサーセッション
log0417
0
180
Contract One Engineering Unit 紹介資料
sansan33
PRO
0
19k
【CEDEC2026】グラフィックスエンジニアのためのニューラルシェーディング入門
cygames
PRO
0
150
DatadogのBits Chatが開発組織にもたらしたもの / What Bits Chat Has Brought Us
sms_tech
1
260
Featured
See All Featured
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
2.9k
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
490
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
400
Balancing Empowerment & Direction
lara
6
1.2k
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
2.1k
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
460
Visualization
eitanlees
152
17k
Java REST API Framework Comparison - PWX 2021
mraible
34
9.6k
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
Unsuck your backbone
ammeep
672
58k
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
640
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
23k
Transcript
None
None
None
None
None
None
None
None
None
None
None
None
None
None
➔ ➔ ➔
species: regulations: - champions-m-a nature: up: down: ability: item: X
moves: - - - - --- party: regulation: champions-m-a members: - ../individuals/garchomp.yaml - ../individuals/dragonite.yaml # … ---
pnpm check:party dragon-standard.md : pnpm analyze:coverage dragon-standard.md : 5 /
0 : 4 / 1 : 4 / 0
species: regulations: - champions-m-a moves: - - - - #
pnpm check:individual charizard-invalid.yaml charizard-invalid.yaml:9: MoveNotLearnedBy: Type 'string' is not assignable to type 'MoveNotLearnedBy< "champions-m-a", "charizard", "surf" >'.
codegen tsc --noEmit OK NG YAML TypeScript tsc --noEmit
species: regulations: - champions-m-a moves: - - - - //
@source charizard.yaml:4 const charizard_moves_champions_m_a: ValidMoves< "champions-m-a", "charizard", readonly [ "flare-blitz", "dragon-claw", "earthquake", "roost" ] > = [ "flare-blitz", "dragon-claw", "earthquake", "roost" ]; ValidMoves charizard_moves_champions_m_a
species: regulations: - champions-m-a moves: - - - - #
// @source charizard-invalid.yaml:4 const charizard_moves_champions_m_a: ValidMoves< "champions-m-a", "charizard", readonly [ "flare-blitz", "dragon-claw", "earthquake", "surf" ] > = [ "flare-blitz", "dragon-claw", "earthquake", "surf" ];
species: regulations: - champions-m-a moves: - - - - #
// @source charizard-invalid.yaml:4 const charizard_moves_champions_m_a: ValidMoves< "champions-m-a", "charizard", readonly [ "flare-blitz", "dragon-claw", "earthquake", "surf" ] > = [ "flare-blitz", "dragon-claw", "earthquake", "surf" ]; roost surf
species: regulations: - champions-m-a moves: - - - - #
roost surf
export type ValidMoves< R extends RegulationId, // S extends SpeciesIdIn<R>,
// Ms extends readonly string[], // > = { readonly [I in keyof Ms]: ValidMove<R, S, Ms[I] & string>; }; Ms
export type ValidMove< R extends RegulationId, // S extends SpeciesIdIn<R>,
// M extends string, // > = M extends SpeciesEntryOf< R, S >["moves"][number] ? M : MoveNotLearnedBy<R, S, M>; SpeciesEntryOf<"champions-m-a", "charizard"> { readonly id: "charizard"; readonly moves: readonly [ "flare-blitz", "dragon-claw", "roost", "earthquake", "swords-dance", ... ] // M-A ... }
export type ValidMove< R extends RegulationId, // S extends SpeciesIdIn<R>,
// M extends string, // > = M extends SpeciesEntryOf< R, S >["moves"][number] ? M : MoveNotLearnedBy<R, S, M>; M [ "flare-blitz", "dragon-claw", "earthquake", "surf" ] → [ "flare-blitz", "dragon-claw", "earthquake", MoveNotLearnedBy ]
charizard_moves_champions_m_a [string, ..., MoveNotLearnedBy] [string, ..., string]
None
None