microsoft / microsoft/TypeScript

Code invalid when [jsx=react-jsx] and [module=system]

Abierto
#41,914 0 comentarios 0 reacciones 1 asignado Ver en GitHub

@weswigham ya está trabajando en esto.

Desde el 10/12/2020.

Needs Investigation Rescheduled
Lenguaje dominante
Go
Estrellas
111k
Forks
14.3k
Merge medio
2 d 4 h
PR fusionados (30 d)
132

Descripción

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

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.