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
20250116 関数型DDD 2
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
saka
December 24, 2025
11
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
20250116 関数型DDD 2
saka
December 24, 2025
More Decks by saka
See All by saka
20250304 関数型DDD 6
sakatttttta
0
25
20241219 Github Actionsの面倒いところ
sakatttttta
0
18
20250109 関数型
sakatttttta
0
11
20250123 関数型DDD 3
sakatttttta
0
11
20250206 関数型DDD 4
sakatttttta
0
12
20250213 関数型DDD 4
sakatttttta
0
12
20250220 Hono カスタムfetch
sakatttttta
0
10
20250225 関数型DDD 5
sakatttttta
0
9
20250311 関数型DDD 7
sakatttttta
0
9
Featured
See All Featured
YesSQL, Process and Tooling at Scale
rocio
174
15k
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
2
6.3k
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
1
570
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
760
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
570
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
570
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
3.2k
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
600
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.9k
The Illustrated Children's Guide to Kubernetes
chrisshort
51
53k
Building the Perfect Custom Keyboard
takai
2
910
Transcript
ؔܕDDD 2
લճ
ίϯύΠϧ=ςετ
ؔ
δΣωϦοΫܕ
ܕͷ߹
type Sample = { | a: ٻ৬ऀͷform; | b: ࠾༻୲ͷform;
};
ଓ͖
୯७ܕ
બࢶ͕Ұ͔ͭ͠ͳ͍
type ProductCode = | ProductCode of string
type ProductCode = ProductCode of string
TypeScript
type ProductCode = string; ܕ҆શΫιͳ͍
ύλʔϯ2 ϒϥϯυܕ
ͷલʹ
TypeScriptͷܕʹ͍ͭͯ
type UserId = string; type ItemId = string;
͜ΕҰॹͷܕͱͯ͠ ѻΘΕΔ
ߏ͕ҰॹͳΒ ΤϥʔͰͳ͍
None
None
type Test = string & { __brand: Teee }
͜ΕͰผͷܕʹͳΔ
type ProductCode = string & { readonly __brand: unique symbol
};
type ProductCode = string & { readonly __brand: unique symbol
}; type SubCode = string & { readonly __brand: unique symbol }; const product: ProductCode = "ABC123" as ProductCode; const sub: SubCode = "DEF456" as SubCode; // Τϥʔ͕ൃੜ const productSub: ProductCode = sub;
جຊతʹ͜ΕstringͳͷͰ ϥϯλΠϜͰΤϥʔͳ͠
ϒϥϯυܕ ίϯύΠϧ࣌ɿΤϥʔ ϥϯλΠϜɿΤϥʔͰͳ͍
ύλʔϯ3
type ProductCode = { Type: "ProductCode"; value: string; };
ίϯύΠϧ࣌ɿΤϥʔ ϥϯλΠϜɿΤϥʔ
ܕ͝ͱʹॲཧΛ͚͍ͨ
function handleCode(code: ProductCode | SubCode) { if (code.tag === "ProductCode")
{ console.log("ProductCode: " + code.value); } else if (code.tag === "SubCode") { console.log("SubCode: " + code.value); } }
Ͳ͕͍͍ͬͪͷ͔