Skip to content
This repository was archived by the owner on Dec 1, 2019. It is now read-only.

Commit 93269b4

Browse files
committed
Use builder with createProgram api
1 parent 64364fe commit 93269b4

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

src/checker/runtime.ts

+12-10
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import {
1919

2020
import { CaseInsensitiveMap } from './fs';
2121
import { isCaseInsensitive } from '../helpers';
22-
22+
2323
const caseInsensitive = isCaseInsensitive();
2424

2525
if (!module.parent) {
@@ -95,10 +95,10 @@ function createChecker(receive: (cb: (msg: Req) => void) => void, send: (msg: Re
9595
fileName => fileName.toLowerCase() :
9696
(fileName => fileName);
9797

98-
let watchHost: ts.WatchCompilerHostOfFilesAndCompilerOptions;
98+
let watchHost: ts.WatchCompilerHostOfFilesAndCompilerOptions<ts.SemanticDiagnosticsBuilderProgram>;
9999
let watch: ts.WatchOfFilesAndCompilerOptions<ts.SemanticDiagnosticsBuilderProgram>;
100-
101-
function createWatchHost(): ts.WatchCompilerHostOfFilesAndCompilerOptions & ts.BuilderProgramHost {
100+
101+
function createWatchHost(): ts.WatchCompilerHostOfFilesAndCompilerOptions<ts.SemanticDiagnosticsBuilderProgram> & ts.BuilderProgramHost {
102102
return {
103103
rootFiles: getRootFiles(),
104104
options: compilerOptions,
@@ -117,7 +117,9 @@ function createChecker(receive: (cb: (msg: Req) => void) => void, send: (msg: Re
117117
watchFile,
118118
watchDirectory,
119119

120-
createHash: (...args) => compiler.sys.createHash.apply(compiler.sys, args)
120+
createProgram: compiler.createSemanticDiagnosticsBuilderProgram,
121+
122+
createHash: (...args) => compiler.sys.createHash.apply(compiler.sys, args)
121123
};
122124

123125
function readFile(fileName: string) {
@@ -131,7 +133,7 @@ function createChecker(receive: (cb: (msg: Req) => void) => void, send: (msg: Re
131133

132134
function createWatch(): ts.WatchOfFilesAndCompilerOptions<ts.SemanticDiagnosticsBuilderProgram> {
133135
watchHost = createWatchHost();
134-
return compiler.createWatchBuilderProgram(watchHost, compiler.createSemanticDiagnosticsBuilderProgram);
136+
return compiler.createWatchProgram(watchHost);
135137
}
136138

137139
function getProgram(): ts.SemanticDiagnosticsBuilderProgram {
@@ -385,10 +387,10 @@ function createChecker(receive: (cb: (msg: Req) => void) => void, send: (msg: Re
385387
replyOk(seq, {
386388
files: getProgram().getSourceFiles().map(f => f.fileName)
387389
});
388-
}
389-
390-
function isAffectedSourceFile(affected: ts.SourceFile | ts.Program): affected is ts.SourceFile {
391-
return (affected as ts.SourceFile).kind === compiler.SyntaxKind.SourceFile;
390+
}
391+
392+
function isAffectedSourceFile(affected: ts.SourceFile | ts.Program): affected is ts.SourceFile {
393+
return (affected as ts.SourceFile).kind === compiler.SyntaxKind.SourceFile;
392394
}
393395

394396
function processDiagnostics({ seq }: Diagnostics.Request) {

0 commit comments

Comments
 (0)