import { Schema } from "@effect/schema"
import type { OptionEncoded } from "@effect/schema/Schema"
export const OptionFromEmptyString = Schema.transform(Schema.String, Schema.Option(Schema.NonEmpty), {
decode: (value): OptionEncoded<string> => (value.length > 0 ? { _tag: "Some", value } : { _tag: "None" }),
encode: (opt) => (opt._tag === "Some" ? opt.value : "")
})
import { Schema } from "@effect/schema"
import type { OptionEncoded } from "@effect/schema/Schema"
export const OptionFromEmptyString = Schema.transform(Schema.String, Schema.Option(Schema.NonEmpty), {
decode: (value): OptionEncoded<string> => (value.length > 0 ? { _tag: "Some", value } : { _tag: "None" }),
encode: (opt) => (opt._tag === "Some" ? opt.value : "")
})