diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 24eeff36c6..118850ab73 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -83,7 +83,7 @@ namespace ts { let text: string | undefined; try { performance.mark("beforeIORead"); - text = host.readFile(fileName); + text = compilerHost.readFile(fileName); performance.mark("afterIORead"); performance.measure("I/O Read", "beforeIORead", "afterIORead"); } @@ -112,8 +112,8 @@ namespace ts { if (directoryPath.length > getRootLength(directoryPath) && !directoryExists(directoryPath)) { const parentDirectory = getDirectoryPath(directoryPath); ensureDirectoriesExist(parentDirectory); - if (host.createDirectory) { - host.createDirectory(directoryPath); + if (compilerHost.createDirectory) { + compilerHost.createDirectory(directoryPath); } else { system.createDirectory(directoryPath); @@ -181,7 +181,7 @@ namespace ts { const newLine = getNewLineCharacter(options, () => system.newLine); const realpath = system.realpath && ((path: string) => system.realpath!(path)); - const host: CompilerHost = { + const compilerHost: CompilerHost = { getSourceFile, getDefaultLibLocation, getDefaultLibFileName: options => combinePaths(getDefaultLibLocation(), getDefaultLibFileName(options)), @@ -200,7 +200,7 @@ namespace ts { readDirectory: (path, extensions, include, exclude, depth) => system.readDirectory(path, extensions, include, exclude, depth), createDirectory: d => system.createDirectory(d) }; - return host; + return compilerHost; } export function getPreEmitDiagnostics(program: Program, sourceFile?: SourceFile, cancellationToken?: CancellationToken): ReadonlyArray { diff --git a/src/compiler/tsbuild.ts b/src/compiler/tsbuild.ts index cd3ed15899..b0f7dd7ac3 100644 --- a/src/compiler/tsbuild.ts +++ b/src/compiler/tsbuild.ts @@ -1230,7 +1230,7 @@ namespace ts { return sourceFile; }; - // fileExits for any kind of extension + // fileExists for any kind of extension host.fileExists = fileName => { const key = toPath(fileName); const value = fileExistsCache.get(key); diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 17444ed970..495465f703 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -5015,7 +5015,7 @@ namespace ts { /* @internal */ hasChangedAutomaticTypeDirectiveNames?: boolean; createHash?(data: string): string; - // TODO: later handle this in better way in builder host instead once the ap + // TODO: later handle this in better way in builder host instead once the api for tsbuild finalizes and doesnt use compilerHost as base /*@internal*/createDirectory?(directory: string): void; }