Skip to content

Commit 1c27379

Browse files
committed
make tsconfig optional
1 parent 9c8b1e3 commit 1c27379

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/index.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,14 @@ export class TypeHelperClass {
4848
};
4949

5050
// get tsconfig path and options
51-
let tsconf = this.getPath(options.tsConfig);
52-
(<IInternalTypeCheckerOptions>this.options).tsConfigJsonContent = require(tsconf);
53-
this.writeText(chalk.yellow(`Typechecker tsconfig: ${chalk.white(`${tsconf}${'\n'}`)}`));
51+
if (options.tsConfig) {
52+
let tsconf = this.getPath(options.tsConfig);
53+
(<IInternalTypeCheckerOptions>this.options).tsConfigJsonContent = require(tsconf);
54+
this.writeText(chalk.yellow(`Typechecker tsconfig: ${chalk.white(`${tsconf}${'\n'}`)}`));
55+
} else {
56+
(<IInternalTypeCheckerOptions>this.options).tsConfigJsonContent = { compilerOptions: {} };
57+
this.writeText(chalk.yellow(`Typechecker tsconfig: ${chalk.white(`undefined, using ts defaults${'\n'}`)}`));
58+
}
5459

5560
if (options.tsConfigOverride) {
5661
let oldConfig = (<IInternalTypeCheckerOptions>this.options).tsConfigJsonContent;

0 commit comments

Comments
 (0)