Obtaining and Refining an Option from a Generic String using Schema

I'm trying to obtain an Option from a generic string and refine it as an union a, b and c. If empty I get Option.None. I already have a combinator string -> Option<string> when empty.
export const optionFromEmptyString = pipe(
  Schema.string,
  Schema.transform(
    Schema.optionFromSelf(Schema.string),
    Option.liftPredicate((s) => s.length > 0),
    (s) => Option.getOrElse(s, () => ""),
  ),
);


Can I leverage Schema.union/Schema.literal without having to map every value in transform after my combinator?
Was this page helpful?