Skip to content

composeTemplates

composeTemplates(…templates): EntityTemplate

Defined in: src/template.ts:25

Compose multiple templates into one. Later templates override earlier ones:

  • name is taken from the last template (so extending a base and renaming produces a sensibly-named descendant).
  • components are shallow-merged by component name — later wins, earlier is kept when a later template does not redeclare that component. No deep merge: if two templates both declare "fighter", the later value replaces the earlier one wholesale.
  • tags are unioned across all inputs (insertion order, de-duplicated).

Passing zero templates throws — an anonymous empty template is never what a caller wants. Passing one template returns a new object equivalent to the input.

…readonly EntityTemplate[]

EntityTemplate