(value: Value)
| 7224 | * @since 3.10.0 |
| 7225 | */ |
| 7226 | export function Option<Value extends Schema.Any>(value: Value): Option<Value> { |
| 7227 | const value_ = asSchema(value) |
| 7228 | const out = transform( |
| 7229 | optionEncoded(value_), |
| 7230 | OptionFromSelf(typeSchema(value_)), |
| 7231 | { |
| 7232 | strict: true, |
| 7233 | decode: (i) => optionDecode(i), |
| 7234 | encode: (a) => |
| 7235 | option_.match(a, { |
| 7236 | onNone: () => makeNoneEncoded, |
| 7237 | onSome: makeSomeEncoded |
| 7238 | }) |
| 7239 | } |
| 7240 | ) |
| 7241 | return out as any |
| 7242 | } |
| 7243 | |
| 7244 | /** |
| 7245 | * @category api interface |
nothing calls this directly
no test coverage detected