CabalDAOC
Convex Community16mo ago
8 replies
CabalDAO

Mapping defined types to other defined types

I have two types:

export const ReferralOverviewStatus = v.union(
  v.literal("new"),
  v.literal("in_review"),
  v.literal("needs_review"),
  v.literal("accepted_awaiting_placement"),
  v.literal("accepted_won"),
  v.literal("accepted_lost"),
  v.literal("bed_hold"),
  v.literal("rejected")
);


And
export const DecisionStatus = v.union(
  v.literal("accepted"),
  v.literal("rejected"),
  v.literal("needs_review")
);


As you can see, DecisionStatus overlaps with ReferralOverviewStatus.

In one mutation, I accept an args type of DecisionStatus and I want to pass it to a mutation that accepts an arg type of ReferralOverviewStatus. I've tried a bunch of different things but I still get typescript errors for all of these. How can I make this work?
Was this page helpful?