Skip to content

Commit 4193846

Browse files
committed
Do not expose change in createCompilerHost
1 parent 0831eda commit 4193846

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed

src/compiler/program.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,12 @@ namespace ts {
6666
mtime: Date;
6767
}
6868

69-
export function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean, system = sys): CompilerHost {
69+
export function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost {
70+
return createCompilerHostWorker(options, setParentNodes);
71+
}
72+
/*@internal*/
73+
// TODO(shkamat): update this after reworking ts build API
74+
export function createCompilerHostWorker(options: CompilerOptions, setParentNodes?: boolean, system = sys): CompilerHost {
7075
const existingDirectories = createMap<boolean>();
7176

7277
function getCanonicalFileName(fileName: string): string {

src/compiler/tsbuild.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ namespace ts {
413413
}
414414

415415
export function createSolutionBuilderHost(system = sys, reportDiagnostic?: DiagnosticReporter, reportSolutionBuilderStatus?: DiagnosticReporter) {
416-
const host = createCompilerHost({}, /*setParentNodes*/ undefined, system) as SolutionBuilderHost;
416+
const host = createCompilerHostWorker({}, /*setParentNodes*/ undefined, system) as SolutionBuilderHost;
417417
host.getModifiedTime = system.getModifiedTime ? path => system.getModifiedTime!(path) : () => undefined;
418418
host.setModifiedTime = system.setModifiedTime ? (path, date) => system.setModifiedTime!(path, date) : noop;
419419
host.deleteFile = system.deleteFile ? path => system.deleteFile!(path) : noop;

tests/baselines/reference/api/tsserverlibrary.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4122,7 +4122,7 @@ declare namespace ts {
41224122
declare namespace ts {
41234123
function findConfigFile(searchPath: string, fileExists: (fileName: string) => boolean, configName?: string): string | undefined;
41244124
function resolveTripleslashReference(moduleName: string, containingFile: string): string;
4125-
function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean, system?: System): CompilerHost;
4125+
function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost;
41264126
function getPreEmitDiagnostics(program: Program, sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[];
41274127
interface FormatDiagnosticsHost {
41284128
getCurrentDirectory(): string;

tests/baselines/reference/api/typescript.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4122,7 +4122,7 @@ declare namespace ts {
41224122
declare namespace ts {
41234123
function findConfigFile(searchPath: string, fileExists: (fileName: string) => boolean, configName?: string): string | undefined;
41244124
function resolveTripleslashReference(moduleName: string, containingFile: string): string;
4125-
function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean, system?: System): CompilerHost;
4125+
function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost;
41264126
function getPreEmitDiagnostics(program: Program, sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[];
41274127
interface FormatDiagnosticsHost {
41284128
getCurrentDirectory(): string;

0 commit comments

Comments
 (0)