ยฉ 2026 Hedgehog Software, LLC
Twitter
GitHub
Discord
System
Light
Dark
More
Communities
Docs
About
Terms
Privacy
Search
Star
Feedback
Setup for Free
Extracting Union Variants from Schema - Effect Community
EC
Effect Community
โข
3y ago
โข
14 replies
RJ
Extracting Union Variants from Schema
Given a schema like this
:
const
Pet
=
Schema.
literal
(
"Dog"
,
"Cat"
)
const
Pet
=
Schema.
literal
(
"Dog"
,
"Cat"
)
What
's the best way to get a value like this
:
[
"Dog"
,
"Cat"
]
[
"Dog"
,
"Cat"
]
That is
, an array
(or actually maybe a tuple would be even better
?
) containing each of the variants of the union
?
Effect Community
Join
Production-grade applications in TypeScript.
6,221
Members
View on Discord
Resources
ModelContextProtocol
ModelContextProtocol
MCP Server
Recent Announcements
Similar Threads
Was this page helpful?
Yes
No
Similar Threads
Extracting Schema Tags from a Union of Tagged Structs
EC
Effect Community / schema
8mo ago
Extracting "Sub" Schema from Schema
EC
Effect Community / schema
2y ago
Extracting `Schema.Literal` from Schema.Struct
EC
Effect Community / schema
2y ago
Extracting `Schema<T>` from `Schema<readonly T[]>`
EC
Effect Community / schema
6mo ago