microsoft / microsoft/TypeScript

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

Aperta
#41,914 0 commenti 0 reazioni 1 assegnatario Vedi su GitHub

@weswigham ci sta già lavorando.

Dal 10/12/2020.

Needs Investigation Rescheduled
Lingua principale
Go
Stelle
111k
Fork
14.3k
Merge medio
2g 4h
PR unite (30g)
132

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.