Hyperlinkv0.8.0-beta.28

Schema

Schema.fromBrandfunctioneffect/Schema.ts:5132
<A extends Brand.Brand<any>>(
  identifier: string,
  ctor: Brand.Constructor<A>
): <S extends Top & { readonly Type: Brand.Brand.Unbranded<A> }>(
  self: S
) => brand<S["Rebuild"], Brand.Brand.Keys<A>>

Creates a branded schema from a Brand.Constructor, applying the constructor's checks and brand tag to the underlying schema.

Source effect/Schema.ts:51327 lines
export function fromBrand<A extends Brand.Brand<any>>(identifier: string, ctor: Brand.Constructor<A>) {
  return <S extends Top & { readonly "Type": Brand.Brand.Unbranded<A> }>(
    self: S
  ): brand<S["Rebuild"], Brand.Brand.Keys<A>> => {
    return (ctor.checks ? self.check(...ctor.checks) : self).pipe(brand(identifier))
  }
}