Requests a union-typed property one branch at a time, so alternatives that need different shapes can each state
their own. Keys are opaque Branch labels telling the alternatives apart; which variants a branch retrieves
is fixed by matching its shape against the property's declared variants, never by its key, so
reordering or renaming variants at the source leaves an existing template valid. A variant left unmatched by every
branch contributes no values, and a branch matching no variant is unsatisfiable and is rejected.
A branch holds one value, never a collection: cardinality belongs to the property as a whole, and the
Criteria constraining it ride on the entry hosting the union. A branch never holds another union directly,
though a branch Template may carry unions of its own.
Branches matching the same variant are merged, so each variant is retrieved once, to the depth the most demanding
branch asks for: a Template or Locale branch prevails over an Atomic one. A property mixing
plain strings and localised text can thus pair an Atomic branch with a Locale one, retrieving the plain strings
as they stand and the localised text tag by tag, as a Dictionary restricted to the selected locales.
Important
A union MUST include at least one branch: the empty object {} is an Atomic. The type admits it only
because TypeScript cannot express a non-empty index signature; isUnion rejects it at runtime.
Union-typed property template.
Requests a union-typed property one branch at a time, so alternatives that need different shapes can each state their own. Keys are opaque Branch labels telling the alternatives apart; which variants a branch retrieves is fixed by matching its shape against the property's declared variants, never by its key, so reordering or renaming variants at the source leaves an existing template valid. A variant left unmatched by every branch contributes no values, and a branch matching no variant is unsatisfiable and is rejected.
A branch holds one value, never a collection: cardinality belongs to the property as a whole, and the Criteria constraining it ride on the entry hosting the union. A branch never holds another union directly, though a branch Template may carry unions of its own.
Branches matching the same variant are merged, so each variant is retrieved once, to the depth the most demanding branch asks for: a Template or Locale branch prevails over an Atomic one. A property mixing plain strings and localised text can thus pair an
Atomicbranch with aLocaleone, retrieving the plain strings as they stand and the localised text tag by tag, as a Dictionary restricted to the selected locales.A union MUST include at least one branch: the empty object
{}is an Atomic. The type admits it only because TypeScript cannot express a non-empty index signature; isUnion rejects it at runtime.See Union for the design rationale.