Repository navigation
Description
🔎 Search Terms
react-jsxdev super this, jsxDEV self before super, Must call super constructor jsx
🕗 Version & Regression Information
Not a regression; jsx: react-jsx is correct.
- Fails: 6.0.3, 7.0.2, 7.1.0-dev.20261107.1, 7.1.0-dev.20261109.1
⏯ Playground Link
(Playground v2, 6.0.3; press Run. The project uses a six-line local jsx-dev-runtime with React's jsxDEV signature, so no packages are needed.)
💻 Code
/** @jsxImportSource ./rt */
class Base { constructor(public content: { type: unknown }) {} }
class Card extends Base {
constructor(title: string) {
super(<h2>{title}</h2>);
}
}
console.log(new Card("Hello").content.type);🙁 Actual behavior
The emit passes this as the self argument of _jsxDEV(...) inside the super(...) arguments, so the constructor throws ReferenceError: Must call super constructor in derived class before accessing 'this'. There is no compile error, and jsx: react-jsx works.
🙂 Expected behavior
h2 is printed: pass undefined for self when this is not yet available (before super() in a derived constructor), as Babel and esbuild do for the same case.
This was found with an AI-assisted differential testing tool; the repros and outputs above were re-run on the listed versions.
Activity