Skip to content

Commit 520e33f

Browse files
committed
PR feedback
1 parent e745fca commit 520e33f

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

src/compiler/watch.ts

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -203,17 +203,14 @@ namespace ts {
203203
TypeRoots = "Type roots"
204204
}
205205

206-
interface WatchFactory<X, Y= undefined> extends ts.WatchFactory<X, Y> {
207-
watchLogLevel: WatchLogLevel;
206+
interface WatchFactory<X, Y = undefined> extends ts.WatchFactory<X, Y> {
208207
writeLog: (s: string) => void;
209208
}
210209

211210
export function createWatchFactory<Y = undefined>(host: { trace?(s: string): void; }, options: { extendedDiagnostics?: boolean; diagnostics?: boolean; }) {
212-
const watchLogLevel = host.trace ? options.extendedDiagnostics ? WatchLogLevel.Verbose :
213-
options.diagnostics ? WatchLogLevel.TriggerOnly : WatchLogLevel.None : WatchLogLevel.None;
211+
const watchLogLevel = host.trace ? options.extendedDiagnostics ? WatchLogLevel.Verbose : options.diagnostics ? WatchLogLevel.TriggerOnly : WatchLogLevel.None : WatchLogLevel.None;
214212
const writeLog: (s: string) => void = watchLogLevel !== WatchLogLevel.None ? (s => host.trace!(s)) : noop;
215213
const result = getWatchFactory<WatchType, Y>(watchLogLevel, writeLog) as WatchFactory<WatchType, Y>;
216-
result.watchLogLevel = watchLogLevel;
217214
result.writeLog = writeLog;
218215
return result;
219216
}
@@ -590,7 +587,7 @@ namespace ts {
590587
newLine = updateNewLine();
591588
}
592589

593-
const { watchFile, watchFilePath, watchDirectory, watchLogLevel, writeLog } = createWatchFactory<string>(host, compilerOptions);
590+
const { watchFile, watchFilePath, watchDirectory, writeLog } = createWatchFactory<string>(host, compilerOptions);
594591
const getCanonicalFileName = createGetCanonicalFileName(useCaseSensitiveFileNames);
595592

596593
writeLog(`Current directory: ${currentDirectory} CaseSensitiveFileNames: ${useCaseSensitiveFileNames}`);
@@ -685,11 +682,9 @@ namespace ts {
685682

686683
function createNewProgram(program: Program, hasInvalidatedResolution: HasInvalidatedResolution) {
687684
// Compile the program
688-
if (watchLogLevel !== WatchLogLevel.None) {
689-
writeLog("CreatingProgramWith::");
690-
writeLog(` roots: ${JSON.stringify(rootFileNames)}`);
691-
writeLog(` options: ${JSON.stringify(compilerOptions)}`);
692-
}
685+
writeLog("CreatingProgramWith::");
686+
writeLog(` roots: ${JSON.stringify(rootFileNames)}`);
687+
writeLog(` options: ${JSON.stringify(compilerOptions)}`);
693688

694689
const needsUpdateInTypeRootWatch = hasChangedCompilerOptions || !program;
695690
hasChangedCompilerOptions = false;

0 commit comments

Comments
 (0)