(schema: S)
| 312 | * @since 4.0.0 |
| 313 | */ |
| 314 | export const optionalOption = <S extends Schema.Constraint>(schema: S): optionalOption<S> => |
| 315 | Schema.optionalKey(Schema.NullOr(schema)).pipe( |
| 316 | Schema.decodeTo( |
| 317 | Schema.Option(Schema.toType(schema)), |
| 318 | SchemaTransformation.transformOptional<Option.Option<S["Type"]>, S["Type"] | null>({ |
| 319 | decode: (oe) => oe.pipe(Option.filter(Predicate.isNotNull), Option.some), |
| 320 | encode: Option.flatten |
| 321 | }) as any |
| 322 | ) |
| 323 | ) |
| 324 | |
| 325 | /** |
| 326 | * Convert a field to one that is optional for all variants. |
nothing calls this directly
no test coverage detected