(schema: S)
| 259 | * @category optional |
| 260 | */ |
| 261 | export const optionalOption = <S extends Schema.Top>(schema: S): optionalOption<S> => |
| 262 | Schema.optionalKey(Schema.NullOr(schema)).pipe( |
| 263 | Schema.decodeTo( |
| 264 | Schema.Option(Schema.toType(schema)), |
| 265 | Transformation.transformOptional<Option.Option<S["Type"]>, S["Type"] | null>({ |
| 266 | decode: (oe) => oe.pipe(Option.filter(Predicate.isNotNull), Option.some), |
| 267 | encode: Option.flatten |
| 268 | }) as any |
| 269 | ) |
| 270 | ) |
| 271 | |
| 272 | /** |
| 273 | * Convert a field to one that is optional for all variants. |
nothing calls this directly
no test coverage detected
searching dependent graphs…