Skip to content

Commit e1ca37e

Browse files
committed
Tweak
1 parent 62d4415 commit e1ca37e

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/bin/ctts.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import yargs from 'yargs/yargs';
2-
import * as ts from 'typescript';
2+
import ts from 'typescript';
33
import pkg from '../../package.json';
44
import { run } from '..';
55

src/index.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as ts from 'typescript';
1+
import ts from 'typescript';
22
import * as tmp from 'tmp-promise';
33
import * as path from 'path';
44

@@ -21,11 +21,12 @@ export async function run(fileName: string, { input = Buffer.of() }: Partial<Run
2121
const defaultCompilerHost = ts.createCompilerHost({});
2222
const customCompilerHost: ts.CompilerHost = {
2323
...defaultCompilerHost,
24-
getSourceFile(fileName: string, languageVersion: ts.ScriptTarget, onError?: ((message: string) => void), shouldCreateNewSourceFile?: boolean): ts.SourceFile | undefined {
24+
getSourceFile(...args) {
25+
const [fileName] = args;
2526
if (fileName === callerFileName) {
2627
return callerSourceFile;
2728
} else {
28-
return defaultCompilerHost.getSourceFile.call(this, fileName, languageVersion, onError, shouldCreateNewSourceFile);
29+
return defaultCompilerHost.getSourceFile.apply(this, args);
2930
}
3031
},
3132
};

0 commit comments

Comments
 (0)