microsoft / microsoft/TypeScript
Code invalid when [jsx=react-jsx] and [module=system]
Open
@weswigham is already working on this.
Since Dec 10, 2020.
Needs Investigation
Rescheduled
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 132
Description
TypeScript Version: 4.2.0-dev.20201210
Search Terms: react-jsx react-jsxdev systemjs code generataion emit
Code
/** x.tsx
* compile with:
* tsc --moduleResolution node --lib esnext --jsx react-jsx --module system x.tsx
*/
import { PureComponent } from 'react';
export class ApplicationRoot extends PureComponent {
render() {
return <h1>Hello, React</h1>;
}
}
Actual behavior:
see "//// <<-- this is wrong" at the end
System.register(["react/jsx-runtime", "react"], function (exports_1, context_1) {
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var jsx_runtime_1, react_1, ApplicationRoot;
var __moduleName = context_1 && context_1.id;
return {
setters: [
function (jsx_runtime_1_1) {
jsx_runtime_1 = jsx_runtime_1_1;
},
function (react_1_1) {
react_1 = react_1_1;
}
],
execute: function () {
ApplicationRoot = /** @class */ (function (_super) {
__extends(ApplicationRoot, _super);
function ApplicationRoot() {
return _super !== null && _super.apply(this, arguments) || this;
}
ApplicationRoot.prototype.render = function () {
return _jsx("h1", { children: "Hello, React" }, void 0); //// <<-- this is wrong
};
return ApplicationRoot;
}(react_1.PureComponent));
exports_1("ApplicationRoot", ApplicationRoot);
}
};
});
Expected behavior: I should be:
return jsx_runtime_1._jsx("h1", { children: "Hello, React" }, void 0);
Playground Link: playground seems down when I report this issue
Related Issues: None
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.