jsx option affects emit (#40775)

This commit is contained in:
Andrew Branch
2020-09-25 12:20:29 -07:00
committed by GitHub
parent b508914f47
commit dc8952d308
3 changed files with 138 additions and 0 deletions
+1
View File
@@ -380,6 +380,7 @@ namespace ts {
name: "jsx",
type: jsxOptionMap,
affectsSourceFile: true,
affectsEmit: true,
paramType: Diagnostics.KIND,
showInSimplifiedHelpView: true,
category: Diagnostics.Basic_Options,
@@ -1598,5 +1598,33 @@ import { x } from "../b";`),
},
]
});
verifyTscWatch({
scenario,
subScenario: "updates emit on jsx option change",
commandLineArgs: ["-w"],
sys: () => {
const index: File = {
path: `${projectRoot}/index.tsx`,
content: `declare var React: any;\nconst d = <div />;`
};
const configFile: File = {
path: `${projectRoot}/tsconfig.json`,
content: JSON.stringify({
compilerOptions: {
jsx: "preserve"
}
})
};
return createWatchedSystem([index, configFile, libFile], { currentDirectory: projectRoot });
},
changes: [
{
caption: "Update 'jsx' to 'react'",
change: sys => sys.writeFile(`${projectRoot}/tsconfig.json`, '{ "compilerOptions": { "jsx": "react" } }'),
timeouts: runQueuedTimeoutCallbacks,
},
]
});
});
}
@@ -0,0 +1,109 @@
Input::
//// [/user/username/projects/myproject/index.tsx]
declare var React: any;
const d = <div />;
//// [/user/username/projects/myproject/tsconfig.json]
{"compilerOptions":{"jsx":"preserve"}}
//// [/a/lib/lib.d.ts]
/// <reference no-default-lib="true"/>
interface Boolean {}
interface Function {}
interface CallableFunction {}
interface NewableFunction {}
interface IArguments {}
interface Number { toExponential: any; }
interface Object {}
interface RegExp {}
interface String { charAt: any; }
interface Array<T> { length: number; [n: number]: T; }
/a/lib/tsc.js -w
Output::
>> Screen clear
[12:00:21 AM] Starting compilation in watch mode...
[12:00:24 AM] Found 0 errors. Watching for file changes.
Program root files: ["/user/username/projects/myproject/index.tsx"]
Program options: {"jsx":1,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"}
Program files::
/a/lib/lib.d.ts
/user/username/projects/myproject/index.tsx
Semantic diagnostics in builder refreshed for::
/a/lib/lib.d.ts
/user/username/projects/myproject/index.tsx
WatchedFiles::
/user/username/projects/myproject/tsconfig.json:
{"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250}
/user/username/projects/myproject/index.tsx:
{"fileName":"/user/username/projects/myproject/index.tsx","pollingInterval":250}
/a/lib/lib.d.ts:
{"fileName":"/a/lib/lib.d.ts","pollingInterval":250}
FsWatches::
FsWatchesRecursive::
/user/username/projects/myproject/node_modules/@types:
{"directoryName":"/user/username/projects/myproject/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
/user/username/projects/myproject:
{"directoryName":"/user/username/projects/myproject","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
exitCode:: ExitStatus.undefined
//// [/user/username/projects/myproject/index.jsx]
var d = <div />;
Change:: Update 'jsx' to 'react'
Input::
//// [/user/username/projects/myproject/tsconfig.json]
{ "compilerOptions": { "jsx": "react" } }
Output::
>> Screen clear
[12:00:28 AM] File change detected. Starting incremental compilation...
[12:00:31 AM] Found 0 errors. Watching for file changes.
Program root files: ["/user/username/projects/myproject/index.tsx"]
Program options: {"jsx":2,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"}
Program files::
/a/lib/lib.d.ts
/user/username/projects/myproject/index.tsx
Semantic diagnostics in builder refreshed for::
WatchedFiles::
/user/username/projects/myproject/tsconfig.json:
{"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250}
/user/username/projects/myproject/index.tsx:
{"fileName":"/user/username/projects/myproject/index.tsx","pollingInterval":250}
/a/lib/lib.d.ts:
{"fileName":"/a/lib/lib.d.ts","pollingInterval":250}
FsWatches::
FsWatchesRecursive::
/user/username/projects/myproject/node_modules/@types:
{"directoryName":"/user/username/projects/myproject/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
/user/username/projects/myproject:
{"directoryName":"/user/username/projects/myproject","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
exitCode:: ExitStatus.undefined
//// [/user/username/projects/myproject/index.js]
var d = React.createElement("div", null);