Skip to content

Commit 299f274

Browse files
refactor: Move definitions closer to usage
1 parent e11103a commit 299f274

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

packages/core/src/multiCompilerHost.ts

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,8 @@ export interface MultiCompilerHost {
3333
}
3434

3535
export function createMultiCompilerHost(fs: Package): MultiCompilerHost {
36-
const useCaseSensitiveFileNames = () => false;
3736
const getCanonicalFileName = ts.createGetCanonicalFileName(false);
38-
const getCurrentDirectory = () => "/";
39-
const getNewLine = () => "\n";
40-
const getDefaultLibFileName = () => "/node_modules/typescript/lib/lib.d.ts";
4137
const toPath = (fileName: string) => ts.toPath(fileName, "/", getCanonicalFileName);
42-
const writeFile = () => {
43-
throw new Error("Not implemented");
44-
};
4538
const languageVersion = ts.ScriptTarget.Latest;
4639
const traceCollector = createTraceCollector();
4740
const compilerOptions: Record<ResolutionOption, ts.CompilerOptions> = {
@@ -231,12 +224,14 @@ export function createMultiCompilerHost(fs: Package): MultiCompilerHost {
231224
sourceFileCache.set(path, sourceFile);
232225
return sourceFile;
233226
},
234-
getDefaultLibFileName,
235-
getCurrentDirectory,
236-
writeFile,
227+
getDefaultLibFileName: () => "/node_modules/typescript/lib/lib.d.ts",
228+
getCurrentDirectory: () => "/",
229+
writeFile: () => {
230+
throw new Error("Not implemented");
231+
},
237232
getCanonicalFileName,
238-
useCaseSensitiveFileNames,
239-
getNewLine,
233+
useCaseSensitiveFileNames: () => false,
234+
getNewLine: () => "\n",
240235
trace: traceCollector.trace,
241236
resolveModuleNameLiterals(moduleLiterals, containingFile, _redirectedReference, options, containingSourceFile) {
242237
return moduleLiterals.map(

0 commit comments

Comments
 (0)