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
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
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
11
1.1k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3.4k
Site-Speed That Sticks
csswizardry
13
1.6k
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.5k
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
370
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
380
Build your cross-platform service in a week with App Engine
jlugia
234
19k
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
570
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
1
630
Why You Should Never Use an ORM
jnunemaker
PRO
61
10k
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
280
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
330
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); } }
Ͳ͕͍͍ͬͪͷ͔