Idiomatic way to represent a union of literals and their associated values in Effect Typescript

What's a more idiomatic way of writing this, so that I don't have this separation.

export const StripeLookupKey = Schema.Union(
    Schema.Literal("topup_250"),
    Schema.Literal("topup_1250"),
    Schema.Literal("topup_6250"),
    Schema.Literal("topup_25000"),
    Schema.Literal("topup_50000")
);

type TopupKey = (typeof StripeLookupKey)["Type"];

function getTopupQuantity(key: TopupKey) {
    return Match.value(key).pipe(
        Match.when("topup_250", () => 250),
        Match.when("topup_1250", () => 1_250),
        Match.when("topup_6250", () => 6_250),
        Match.when("topup_25000", () => 25_000),
        Match.when("topup_50000", () => 50_000),
        Match.exhaustive
    );
}


?
Was this page helpful?