microsoft / microsoft/TypeScript
Code invalid when [jsx=react-jsx] and [module=system]
Ouverte
@weswigham y travaille déjà.
Depuis le 10/12/2020.
Needs Investigation
Rescheduled
- Langage dominant
- Go
- Étoiles
- 111k
- Forks
- 14.3k
- Merge moyen
- 2 j 4 h
- PR mergées (30 j)
- 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
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Évaluation
Cette issue n'a pas encore été évaluée.