diff --git a/packages/typescript/internal/worker/index.js b/packages/typescript/internal/worker/index.js index 08bf8661da..8627b330bd 100644 --- a/packages/typescript/internal/worker/index.js +++ b/packages/typescript/internal/worker/index.js @@ -26,7 +26,7 @@ const reportWatchStatusChanged = (diagnostic) => { worker.debug(ts.formatDiagnostic(diagnostic, formatHost)); }; function createWatchProgram(options, tsconfigPath, setTimeout) { - const host = createWatchCompilerHost(tsconfigPath, options, Object.assign(Object.assign({}, ts.sys), { setTimeout }), ts.createEmitAndSemanticDiagnosticsBuilderProgram, reportDiagnostic, reportWatchStatusChanged); + const host = createWatchCompilerHost(tsconfigPath, options, Object.assign(Object.assign({}, ts.sys), { setTimeout }), ts.createSemanticDiagnosticsBuilderProgram, reportDiagnostic, reportWatchStatusChanged); return ts.createWatchProgram(host); } let workerRequestTimestamp; diff --git a/packages/typescript/internal/worker/worker_adapter.ts b/packages/typescript/internal/worker/worker_adapter.ts index 3f6f7c218e..46d36be97d 100644 --- a/packages/typescript/internal/worker/worker_adapter.ts +++ b/packages/typescript/internal/worker/worker_adapter.ts @@ -42,7 +42,7 @@ function createWatchProgram( options: ts.CompilerOptions, tsconfigPath: string, setTimeout: ts.System['setTimeout']) { const host = createWatchCompilerHost( tsconfigPath, options, {...ts.sys, setTimeout}, - ts.createEmitAndSemanticDiagnosticsBuilderProgram, reportDiagnostic, + ts.createSemanticDiagnosticsBuilderProgram, reportDiagnostic, reportWatchStatusChanged); // `createWatchProgram` creates an initial program, watches files, and updates @@ -57,7 +57,7 @@ let workerRequestTimestamp: number|undefined; /** * The typescript compiler in watch mode. */ -let cachedWatchedProgram:|ts.WatchOfConfigFile| +let cachedWatchedProgram:|ts.WatchOfConfigFile| undefined; /** * Callback provided by ts.System which should be called at the point at which @@ -68,7 +68,7 @@ let consolidateChangesCallback: ((...args: any[]) => void)|undefined; let cachedWatchProgramArgs: string|undefined; function getWatchProgram(args: string[]): - ts.WatchOfConfigFile { + ts.WatchOfConfigFile { const newWatchArgs = args.join(' '); // Check to see if the watch program needs to be updated or if we can re-use the old one. diff --git a/packages/typescript/test/ts_project/worker/second.ts b/packages/typescript/test/ts_project/worker/second.ts new file mode 100644 index 0000000000..95e2895cd4 --- /dev/null +++ b/packages/typescript/test/ts_project/worker/second.ts @@ -0,0 +1 @@ +export const second: string = 'second';