From 5c3a8d0aa781082ee7c89683e80354176c429f32 Mon Sep 17 00:00:00 2001 From: hasparus Date: Fri, 12 Oct 2018 14:18:00 +0200 Subject: [PATCH 1/2] Default compilerOptions.jsx to JSXEmit.React Defaults compilerOptions.jsx to JSXEmit.React in getTransformers. --- src/compiler/transformer.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/compiler/transformer.ts b/src/compiler/transformer.ts index b78202e0c3d58..a5aa09a951006 100644 --- a/src/compiler/transformer.ts +++ b/src/compiler/transformer.ts @@ -25,7 +25,8 @@ namespace ts { } export function getTransformers(compilerOptions: CompilerOptions, customTransformers?: CustomTransformers) { - const jsx = compilerOptions.jsx; + const jsx = compilerOptions.jsx || JsxEmit.React; + const languageVersion = getEmitScriptTarget(compilerOptions); const moduleKind = getEmitModuleKind(compilerOptions); const transformers: TransformerFactory[] = []; From 3382d82486fdd891e574e2e40107179d6d51df18 Mon Sep 17 00:00:00 2001 From: hasparus Date: Fri, 12 Oct 2018 14:48:15 +0200 Subject: [PATCH 2/2] Set tsconfig.json "jsx" key to "react". Commented out value of jsx in tsconfig.json after running `tsc --init` is now "react". --- src/compiler/commandLineParser.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 56767b9420b6b..d971da3ad6bff 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -234,9 +234,9 @@ namespace ts { { name: "jsx", type: createMapFromTemplate({ + "react": JsxEmit.React, "preserve": JsxEmit.Preserve, "react-native": JsxEmit.ReactNative, - "react": JsxEmit.React }), affectsSourceFile: true, paramType: Diagnostics.KIND,