From 2d899275ef99752005d795d91ab75f89d7de6a21 Mon Sep 17 00:00:00 2001 From: Spencer Date: Wed, 23 May 2018 12:05:08 -0700 Subject: [PATCH] [ts] put JSX support in root tsconfig file (#19359) --- package.json | 2 ++ src/optimize/base_optimizer.js | 1 - tsconfig.json | 3 +++ yarn.lock | 17 +++++++++++++++++ 4 files changed, 22 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index d79078bd8267..ae79b5d562b8 100644 --- a/package.json +++ b/package.json @@ -232,6 +232,8 @@ "@types/glob": "^5.0.35", "@types/listr": "^0.13.0", "@types/minimatch": "^2.0.29", + "@types/react": "^16.3.14", + "@types/react-dom": "^16.0.5", "angular-mocks": "1.4.7", "babel-eslint": "8.1.2", "babel-jest": "^22.4.3", diff --git a/src/optimize/base_optimizer.js b/src/optimize/base_optimizer.js index 5d87e553d6e7..2825774d7454 100644 --- a/src/optimize/base_optimizer.js +++ b/src/optimize/base_optimizer.js @@ -281,7 +281,6 @@ export default class BaseOptimizer { experimentalWatchApi: true, onlyCompileBundledFiles: true, compilerOptions: { - jsx: 'react', sourceMap: Boolean(this.sourceMaps), target: 'es5', module: 'esnext', diff --git a/tsconfig.json b/tsconfig.json index d66b58425f93..eb218de056e4 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,6 +2,9 @@ "compilerOptions": { "baseUrl": ".", + // Support .tsx files and transform JSX into calls to React.createElement + "jsx": "react", + // Enables all strict type checking options. "strict": true, diff --git a/yarn.lock b/yarn.lock index e4ee0e9d7b41..d8c717759842 100644 --- a/yarn.lock +++ b/yarn.lock @@ -324,6 +324,19 @@ dependencies: "@types/retry" "*" +"@types/react-dom@^16.0.5": + version "16.0.5" + resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-16.0.5.tgz#a757457662e3819409229e8f86795ff37b371f96" + dependencies: + "@types/node" "*" + "@types/react" "*" + +"@types/react@*", "@types/react@^16.3.14": + version "16.3.14" + resolved "https://registry.yarnpkg.com/@types/react/-/react-16.3.14.tgz#f90ac6834de172e13ecca430dcb6814744225d36" + dependencies: + csstype "^2.2.0" + "@types/retry@*", "@types/retry@^0.10.2": version "0.10.2" resolved "https://registry.yarnpkg.com/@types/retry/-/retry-0.10.2.tgz#bd1740c4ad51966609b058803ee6874577848b37" @@ -3231,6 +3244,10 @@ cssom@0.3.x, "cssom@>= 0.3.0 < 0.4.0", "cssom@>= 0.3.2 < 0.4.0": dependencies: cssom "0.3.x" +csstype@^2.2.0: + version "2.5.2" + resolved "https://registry.yarnpkg.com/csstype/-/csstype-2.5.2.tgz#4534308476ceede8fbe148b9b99f9baf1c80fa06" + currently-unhandled@^0.4.1: version "0.4.1" resolved "https://registry.yarnpkg.com/currently-unhandled/-/currently-unhandled-0.4.1.tgz#988df33feab191ef799a61369dd76c17adf957ea"