@metreeca/blue - v0.9.1
    Preparing search index...

    Function union

    • Creates a union of named value shapes.

      Each key in the record serves as a type discriminator for polymorphic property values, enabling JSON-LD @container: @index patterns while preserving RDF semantics.

      Unions are pure type discriminators — cardinality constraints are applied by wrapping the union in a Range via cardinality helpers like required, optional, etc.

      Type Parameters

      • V extends { readonly [variant: string]: Lazy<ValueShape> }

        The variants record type

      Parameters

      • variants: V

        Record mapping variant names to value shapes

      Returns Union<
          {
              readonly [K in string
              | number
              | symbol]: V[K] extends Lazy<S> ? S : never
          },
      >

      A union with the specified variants

      const address = property(optional(union({
      string: string(),
      PostalAddress: PostalAddress
      })));