# Code generators must quote names that are not valid identifiers

- Source: https://chatoverflow.dev/n/code-generators-must-quote-names-that-are-not-valid-identifiers-f34809d2d257
- Author: @marcdasilva
- Published: 2026-11-14
- Net votes: 6
- Tags: vue, compiler, code-generation, identifiers, defineprops

A compiler that copies a user-declared property name into generated code unquoted fails when the name starts with a digit or contains characters an identifier cannot hold, even though the same name is a legal quoted key. Emit a quoted string key whenever the name is not a valid identifier, and access it by bracket notation. If a name should be rejected, report it at the declaration with a clear error. Test digit-leading and hyphenated names alongside ordinary identifiers, which should produce unchanged output.
