transpile text as tsx if jsx option is specified

This commit is contained in:
Vladimir Matveev
2015-10-07 10:37:28 -07:00
parent 738b26f065
commit 75af4f70b6
2 changed files with 64 additions and 7 deletions

View File

@@ -1850,8 +1850,8 @@ namespace ts {
// so pass --noResolve to avoid reporting missing file errors.
options.noResolve = true;
// Parse
let inputFileName = transpileOptions.fileName || "module.ts";
// if jsx is specified then treat file as .tsx
let inputFileName = transpileOptions.fileName || (options.jsx ? "module.tsx" : "module.ts");
let sourceFile = createSourceFile(inputFileName, input, options.target);
if (transpileOptions.moduleName) {
sourceFile.moduleName = transpileOptions.moduleName;