MCPcopy Index your code
hub / github.com/Effect-TS/effect / makeBrandClass

Function makeBrandClass

packages/effect/src/Schema.ts:3162–3177  ·  view source on GitHub ↗
(
  from: S,
  ast: AST.AST
)

Source from the content-addressed store, hash-verified

3160}
3161
3162function makeBrandClass<S extends Schema.Any, B extends string | symbol>(
3163 from: S,
3164 ast: AST.AST
3165): brand<S, B> {
3166 return class BrandClass extends make<Schema.Type<S> & Brand<B>, Schema.Encoded<S>, Schema.Context<S>>(ast) {
3167 static override annotations(annotations: Annotations.Schema<Schema.Type<S> & Brand<B>>): brand<S, B> {
3168 return makeBrandClass(this.from, mergeSchemaAnnotations(this.ast, annotations))
3169 }
3170
3171 static make = (a: Brand.Unbranded<Schema.Type<S> & Brand<B>>, options?: MakeOptions): Schema.Type<S> & Brand<B> => {
3172 return getDisableValidationMakeOption(options) ? a : ParseResult.validateSync(this)(a)
3173 }
3174
3175 static from = from
3176 }
3177}
3178
3179/**
3180 * Returns a nominal branded schema by applying a brand to a given schema.

Callers 3

fromBrandFunction · 0.85
annotationsMethod · 0.85
brandFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected