Skip to content

Commit 967c69f

Browse files
authored
Merge pull request #218 from typed-ember/error-loop
Avoid an infinite loop when requesting compiler options
2 parents 6c9371c + 5cf202e commit 967c69f

File tree

1 file changed

+6
-2
lines changed
  • lib/incremental-typescript-compiler

1 file changed

+6
-2
lines changed

lib/incremental-typescript-compiler/index.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ module.exports = class IncrementalTypescriptCompiler {
2929

3030
this._ts = project.require('typescript');
3131
this._watchProgram = null;
32+
this._compilerOptions = null;
3233
}
3334

3435
treeForHost() {
@@ -115,6 +116,10 @@ module.exports = class IncrementalTypescriptCompiler {
115116
}
116117
}
117118
});
119+
120+
// Prefetch the compiler options, because fetching them while reporting a diagnostic
121+
// can result in a diagnostic-reporting loop in certain states
122+
this._compilerOptions = this.getProgram().getCompilerOptions();
118123
}
119124

120125
getProgram() {
@@ -130,8 +135,7 @@ module.exports = class IncrementalTypescriptCompiler {
130135
}
131136

132137
_shouldFailOnTypeError() {
133-
let options = this.getProgram().getCompilerOptions();
134-
return !!options.noEmitOnError;
138+
return !!this._compilerOptions.noEmitOnError;
135139
}
136140

137141
_mirageDirectory() {

0 commit comments

Comments
 (0)