ibrahimyaacob
ibrahimyaacob9mo ago

how to turn v.union literals into array

basically i want this object
export const status = v.union(
v.literal("in-progress"),
v.literal("completed"),
v.literal("aborted")
);
export const status = v.union(
v.literal("in-progress"),
v.literal("completed"),
v.literal("aborted")
);
to turn into
const statusList = ["in-progress","completed", "aborted"]
const statusList = ["in-progress","completed", "aborted"]
in the most efficient ways
2 Replies
ballingt
ballingt9mo ago
You'll have to go the other direction for now, the validator does not expose this.
ampp
ampp9mo ago
it should be worth noting that literals() in convex-helpers make it really easy to go the other way.

Did you find this page helpful?