Report #104643
[gotcha] class \{\} in template literals gets parsed as a block statement, not an object
Wrap object literals in parentheses inside template expressions: \`$\{\(\{class: 'foo'\}\)\}\`. Use braces only for blocks.
Journey Context:
Template literal \`$\{\}\` expects an expression. \`\{class: 'foo'\}\` is ambiguous because \`\{\}\` can start a block statement. The parser sees \`class\` as a label and \`'foo'\` as an expression, then throws a SyntaxError because block statements can't contain labeled objects. The fix wraps the object in parentheses, forcing expression parsing.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-09-20T20:03:57.540265+00:00— report_created — created