Skip to content

Commit 90a71a2

Browse files
committed
Backwards compatibility for typescript path
1 parent a08d232 commit 90a71a2

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
@@ -39,6 +39,7 @@ interface Logger {
3939
}
4040

4141
interface Options {
42+
typescript?: string;
4243
tsconfig: string;
4344
compilerOptions: object;
4445
tslint: string | true;
@@ -115,7 +116,7 @@ class ForkTsCheckerWebpackPlugin {
115116

116117
vue: boolean;
117118

118-
constructor(typescriptPath?: string | null, options?: Partial<Options>) {
119+
constructor(options?: Partial<Options>) {
119120
options = options || ({} as Options);
120121
this.options = Object.assign({}, options);
121122

@@ -171,8 +172,8 @@ class ForkTsCheckerWebpackPlugin {
171172
this.doneCallback = this.createDoneCallback();
172173

173174
// tslint:disable-next-line:no-implicit-dependencies
174-
this.typescriptPath = typescriptPath || require.resolve('typescript');
175-
this.typescriptVersion = require(typescriptPath).version;
175+
this.typescriptPath = options.typescript || require.resolve('typescript');
176+
this.typescriptVersion = require(this.typescriptPath).version;
176177
this.tslintVersion = this.tslint
177178
? // tslint:disable-next-line:no-implicit-dependencies
178179
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
{},
8081
plugin.tslintPath || false,

0 commit comments

Comments
 (0)