const attempt = Schema.transform(
Schema.Struct({
foo: Schema.Struct({
bar: Schema.optionalWith(Schema.String, { as: 'Option', nullable: true }),
}),
}),
Schema.Option(Schema.String),
{
strict: true,
encode: (value) => ({ foo: { bar: Option.getOrNull(value) } }),
decode: (value) => value.foo.bar,
},
)
const attempt = Schema.transform(
Schema.Struct({
foo: Schema.Struct({
bar: Schema.optionalWith(Schema.String, { as: 'Option', nullable: true }),
}),
}),
Schema.Option(Schema.String),
{
strict: true,
encode: (value) => ({ foo: { bar: Option.getOrNull(value) } }),
decode: (value) => value.foo.bar,
},
)