Skip to content

Commit 8dc16d9

Browse files
committed
Do not expose change in createCompilerHost
1 parent 188d5a0 commit 8dc16d9

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
@@ -412,7 +412,7 @@ namespace ts {
412412
}
413413

414414
export function createSolutionBuilderHost(system = sys, reportDiagnostic?: DiagnosticReporter, reportSolutionBuilderStatus?: DiagnosticReporter) {
415-
const host = createCompilerHost({}, /*setParentNodes*/ undefined, system) as SolutionBuilderHost;
415+
const host = createCompilerHostWorker({}, /*setParentNodes*/ undefined, system) as SolutionBuilderHost;
416416
host.getModifiedTime = system.getModifiedTime ? path => system.getModifiedTime!(path) : () => undefined;
417417
host.setModifiedTime = system.setModifiedTime ? (path, date) => system.setModifiedTime!(path, date) : noop;
418418
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
@@ -4105,7 +4105,7 @@ declare namespace ts {
41054105
declare namespace ts {
41064106
function findConfigFile(searchPath: string, fileExists: (fileName: string) => boolean, configName?: string): string | undefined;
41074107
function resolveTripleslashReference(moduleName: string, containingFile: string): string;
4108-
function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean, system?: System): CompilerHost;
4108+
function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost;
41094109
function getPreEmitDiagnostics(program: Program, sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[];
41104110
interface FormatDiagnosticsHost {
41114111
getCurrentDirectory(): string;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4105,7 +4105,7 @@ declare namespace ts {
41054105
declare namespace ts {
41064106
function findConfigFile(searchPath: string, fileExists: (fileName: string) => boolean, configName?: string): string | undefined;
41074107
function resolveTripleslashReference(moduleName: string, containingFile: string): string;
4108-
function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean, system?: System): CompilerHost;
4108+
function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost;
41094109
function getPreEmitDiagnostics(program: Program, sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[];
41104110
interface FormatDiagnosticsHost {
41114111
getCurrentDirectory(): string;

0 commit comments

Comments
 (0)