Trouble Composing Schemas with Transformations in Effect Typescript Library

I am having trouble composing some schemas.

For example I have defined a BooleanFromSwitch, which is a property signature: optionalToRequired(Literal('on'), Boolean) , and a BinaryFromBoolean, which is a transform transform(NumberFromString, NullOr(Number).

I need to include a published field in a Struct which transforms a Switch to a Binary and I would rather compose existing schemas, but I understand that I can't simply compose the 2.

I also tried to compose 2 Struct containing that field and then using extend to merge it with the rest of the final Struct, but it fails at runtime. The composition also does not have a fields field I can spread directly.

Is my only option to define a BinaryFromSwitch?
Was this page helpful?