Skip to content

NameConflictResolver

A callable interface invoked by the binder when two or more symbols in the same scope share a name. The resolver mutates symbol names to eliminate conflicts (e.g., appending _2, _3).

Call signature(name: string, symbols: OutputSymbol[]) => void

The resolver is called with the shared name and all symbols in the scope that have that original name. Rename a symbol by assigning to symbol.name. Symbols with ignoreNameConflict: true are excluded. The default resolver keeps the first symbol unchanged and renames subsequent ones originalName + "_2", originalName + "_3", etc.

Assigned names pass through the active name policy before being stored; design suffixes to produce the correct final name after policy transformation, or set ignoreNamePolicy on the symbol after resolution.

Conflict detection is keyed on originalName (see [unresolved link]). Symbols that differ in original name but normalize to the same policy-applied name are never detected as conflicting.

const resolver: NameConflictResolver = (name, symbols) => {
  for (let i = 1; i < symbols.length; i++) {
    symbols[i].name = symbols[i].originalName + "_" + (i + 1);
  }
};