Skip to content

Commit 4026926

Browse files
committed
Backwards compatibility for typescript path
1 parent 181f4e4 commit 4026926

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/index.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ interface Logger {
3838
}
3939

4040
interface Options {
41+
typescript?: string;
4142
tsconfig: string;
4243
tslint: string | true;
4344
watch: string | string[];
@@ -110,7 +111,7 @@ class ForkTsCheckerWebpackPlugin {
110111

111112
vue: boolean;
112113

113-
constructor(typescriptPath?: string | null, options?: Partial<Options>) {
114+
constructor(options?: Partial<Options>) {
114115
options = options || ({} as Options);
115116
this.options = Object.assign({}, options);
116117

@@ -161,8 +162,8 @@ class ForkTsCheckerWebpackPlugin {
161162
this.doneCallback = this.createDoneCallback();
162163

163164
// tslint:disable-next-line:no-implicit-dependencies
164-
this.typescriptPath = typescriptPath || require.resolve('typescript');
165-
this.typescriptVersion = require(typescriptPath).version;
165+
this.typescriptPath = options.typescript || require.resolve('typescript');
166+
this.typescriptVersion = require(this.typescriptPath).version;
166167
this.tslintVersion = this.tslint
167168
? // tslint:disable-next-line:no-implicit-dependencies
168169
require('tslint').Linter.VERSION

test/integration/vue.spec.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ describe('[INTEGRATION] vue', function() {
7575
};
7676

7777
checker = new IncrementalChecker(
78+
require.resolve('typescript'),
7879
plugin.tsconfigPath,
7980
plugin.tslintPath || false,
8081
[compiler.context],

0 commit comments

Comments
 (0)