How to do a picklist that depending on the value of another picklist? #1151
Answered
by
muningis
codenoobforreal
asked this question in
Q&A
-
const codecToContainerFormatMap = {
"h264": ["mp4", "mkv", "mov", "avi", "flv", "ts", "webm"],
"h265": ["mp4", "mkv", "mov", "ts"],
} as const;
v.object({
codec: v.picklist(["h264","h265"]),
format: v.picklist(?),
}), |
Beta Was this translation helpful? Give feedback.
Answered by
muningis
Apr 11, 2025
Replies: 1 comment
-
That would be discriminated union (https://www.totaltypescript.com/discriminated-unions-are-a-devs-best-friend), which can be achieved using https://valibot.dev/api/variant/ |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
codenoobforreal
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
That would be discriminated union (https://www.totaltypescript.com/discriminated-unions-are-a-devs-best-friend), which can be achieved using https://valibot.dev/api/variant/
Playground link