@metreeca/qest - v0.10.0
    Preparing search index...

    Type Alias Union

    Union: { readonly [branch: `${number}`]: Placeholder | Locales }

    Union-typed property template.

    An object whose keys are opaque non-negative integer strings, each mapping to one branch's value to retrieve. The keys only label the alternatives: the variants a branch retrieves are fixed by matching it, by type compatibility, against the property's declared variants, never by its key; a variant left unmatched by any branch is skipped. Matching is type-only, so a branch may match several same-typed variants, retrieving each, and its value is immaterial; a branch matching no variant is unsatisfiable and rejected. Because the keys are immaterial, reordering or renaming variants in the source declaration leaves existing templates valid, as long as each branch still matches at least one variant. A non-union slot uses a plain Placeholder directly, the sibling Model form, rather than a Union.

    A branch holds a Placeholder, never a nested Union: a Union cannot stack directly inside another, though a branch Template may carry its own Unions. A branch is a single value, never a collection: cardinality stays a property-level concern, expressed by wrapping the whole Union in a Query.

    Note

    A branch may also be a Locales map, but only within a Projection: when a binding's Expression traverses a multi-step path through a union-typed step to a downstream localised property and addresses it structurally, that branch retrieves a resource!Dictionary. A Locales branch never arises when retrieving a resource property directly, where a localised property is retrieved through Locales as a sibling Model form rather than as a union branch.

    Note

    The `${number}` key space is disjoint from the Binding / Identifier key spaces used by Template and Projection, so form discrimination is structural and unambiguous for fresh object literals. Runtime validators enforce numeric-key wellformedness (no decimals, negatives, or exponential forms); resolving which variant each placeholder retrieves is a processor concern, matched against the out-of-band declared variants.

    Note

    An empty Union object ({}), whether it appears directly as a field value or as a collection tuple's element, carries no retrieval instructions and must be ignored by processors as if the owning field were omitted from the enclosing template. Variants are evaluated independently: a variant whose body is an empty Template ({}) is dropped from the union; when every variant is dropped, the whole union is elided by the same rule.

    Type Declaration

    • Model for the single-value umbrella admitting this and the other non-collection forms
    • Union for the design rationale