Ā© 2026 Hedgehog Software, LLC
type MySchema = Schema.Schema< { a?: string | undefined; b?: string | undefined }, { a?: string; b: Option<string> } >;
const MySchema = Schema.struct({ a: Schema.optional(Schema.string), b: Schema.optional(Schema.string).toOption(), });
Schema.Schema<{ readonly a?: string; readonly b?: string; }, { readonly a?: string; readonly b: Option<string>; }>
undefined
const decoded = decode({ a: undefined }); // ^? Type 'undefined' is not assignable to type 'string'.
const MySchema = Schema.struct({ a: Schema.optional(Schema.union(Schema.string, Schema.undefined)), b: Schema.optional(Schema.union(Schema.string, Schema.undefined)).toOption(), });
a
b
Option<string | undefined>
Option<string>