© 2026 Hedgehog Software, LLC
export const withDefaults = <Self extends S.Schema<any, any>>(s: Self) => { const a = Object.assign(S.parseSync(s) as WithDefaults<Self>, s) Object.setPrototypeOf(a, Object.getPrototypeOf(s)) return a } export type WithDefaults<Self extends S.Schema<any, any>> = ( i: S.Schema.From<Self>, options?: AST.ParseOptions ) => S.Schema.To<Self>
export type NonEmptyStringBrand = B.Brand<"NonEmptyString"> export type NonEmptyString = string & NonEmptyStringBrand export const NonEmptyString = nonEmptyString .pipe( S.annotations({ [TitleAnnotationId]: "NonEmptyString" }), fromBrand(nominal<NonEmptyString>()), withDefaults )
NonEmptyString("test string")