When a .map() callback uses destructuring in its parameter list, the JSX inside the callback is emitted verbatim to the served source, causing a syntax error in the browser.
Repro
const entries: [string, string][] = [['a', 'Alpha'], ['b', 'Beta']];
function Tabs() {
return (
<div>
{entries.map(([key, label]) => (
<button key={key}>{label}</button>
))}
</div>
);
}
Actual
Browser console:
Uncaught SyntaxError: Unexpected token '<'
In the served .tsx (compiled output), the body is still raw JSX:
__append(__el13, __child(() => entries.map(([key, label]) => (
<button key={key}>{label}</button>
))));
The outer structure is transformed, but <button> inside the callback isn't.
Expected
JSX inside .map() callbacks is transformed regardless of whether the callback parameter uses destructuring.
Workaround
Replace tuples/destructuring with object-shaped array entries:
const entries = [{ key: 'a', label: 'Alpha' }, { key: 'b', label: 'Beta' }];
entries.map((x) => <button key={x.key}>{x.label}</button>)
Environment
- Vertz 0.2.64 (dev server)
- macOS arm64, Node v22
When a
.map()callback uses destructuring in its parameter list, the JSX inside the callback is emitted verbatim to the served source, causing a syntax error in the browser.Repro
Actual
Browser console:
In the served
.tsx(compiled output), the body is still raw JSX:The outer structure is transformed, but
<button>inside the callback isn't.Expected
JSX inside
.map()callbacks is transformed regardless of whether the callback parameter uses destructuring.Workaround
Replace tuples/destructuring with object-shaped array entries:
Environment