Bugfix: How to handle naming collision between an autoFlashState sig...

Documentation for Sessions

🐛 Bugfix: How to handle naming collision between an autoFlashState sig...

Date: 2026-03-26
Time: 16:20:02 UTC
Session: gspace1-271.12
Agent: angular
Confidence: 97%
Status: ✅ Documented


📋 Decision Context

Question:

How to handle naming collision between an autoFlashState signal property and an @Input() setter with the same name in an Angular Element?

Task: Fix duplicate member warning between signal and @Input in Angular Elements


🎯 Decision Made

Chosen:

Use @Input('zoom') set zoomAttr(v: string) — give the setter a different property name but keep the HTML attribute alias matching the desired attribute name. The public signal keeps the canonical name (zoom) for template/method use.

Options Considered:

  1. @Input('zoom') set zoomAttr(v) (chosen)
  2. Rename signal property to _zoom (breaks template readability)
  3. Drop the @Input entirely and use only flash-persisted default
  4. Use a different attribute name like initial-zoom

💭 Reasoning

When a class declares readonly zoom = autoFlashState(...) AND @Input() set zoom(v: string), TypeScript/esbuild emits a Duplicate member "zoom" warning because both occupy the same property slot. Renaming the setter to zoomAttr while keeping the @Input('zoom') alias resolves the collision: the HTML attribute zoom="week" still maps correctly via the alias, the signal property zoom is used in the template and methods, and esbuild compiles without warnings. This is the general pattern whenever a flash-persisted signal and an @Input share the same conceptual name.


📁 Files Involved


🔗 Related


Auto-generated by MCP Smart Consolidation