TypeScript Version: 2.1.4 / nightly (typescript@2.2.0-dev.20161224)
Code
Compiling the below code
import*asReactfrom'react';declarefunctioncreateComponentClass<P>(factory: ()=>React.ComponentClass<P>): React.ComponentClass<P>;classFooextendscreateComponentClass(()=>classextendsReact.Component<{},{}>{render(){return<span>Hello,world!</span>;}}){}with compiler option
{
"compilerOptions": {
"jsx": "react"
}
}results in
"use strict";var__extends=(this&&this.__extends)||function(d,b){for(varpinb)if(b.hasOwnProperty(p))d[p]=b[p];function__(){this.constructor=d;}d.prototype=b===null ? Object.create(b) : (__.prototype=b.prototype,new__());};varReact=require("react");varFoo=(function(_super){__extends(Foo,_super);functionFoo(){return_super.apply(this,arguments)||this;}returnFoo;}(createComponentClass(function(){return(function(_super){__extends(class_1,_super);functionclass_1(){return_super.apply(this,arguments)||this;}class_1.prototype.render=function(){return<span>Hello, world!</span>;};returnclass_1;}(React.Component));})));Expected behavior:
<span>Hello, world!</span> is converted to something like React.createElement("span", null, "Hello, world!");.
Actual behavior:
<span>Hello, world!</span> remains as is, though the extension of the emitted file is .js.
TypeScript Version: 2.1.4 / nightly (typescript@2.2.0-dev.20161224)
Code
Compiling the below code
with compiler option
{ "compilerOptions": { "jsx": "react" } }results in
Expected behavior:
<span>Hello, world!</span>is converted to something likeReact.createElement("span", null, "Hello, world!");.Actual behavior:
<span>Hello, world!</span>remains as is, though the extension of the emitted file is.js.