fix(compiler-cli): disableTypeScriptVersionCheck should be applied even for older tsc versions (#22669)

Previously the flag would only disable the check in the case we tried to use newer tsc version.

In g3 we sometimes take a while to update tsc, but as a prerequisite of that Angular needs to be
updated first. This change enables us to update Angular and use it in g3 while g3 is being update
to the required tsc. Of course extra care is required when this check is disabled, but since we
control everything in g3, it's on us to get this right.

I don't see any preexisting tests for this, and I'm not sure how to write them right now.
I filed https://github.com/angular/angular/issues/22699

PR Close #22669
This commit is contained in:
Igor Minar 2018-03-10 10:10:11 -08:00 committed by Kara Erickson
parent eb6fb2d8f9
commit 3f70aba272
1 changed files with 1 additions and 1 deletions

View File

@ -73,7 +73,7 @@ class AngularCompilerProgram implements Program {
private host: CompilerHost, oldProgram?: Program) {
this.rootNames = [...rootNames];
if (ts.version < '2.7.2' || (ts.version >= '2.8.0' && !options.disableTypeScriptVersionCheck)) {
if ((ts.version < '2.7.2' || ts.version >= '2.8.0') && !options.disableTypeScriptVersionCheck) {
throw new Error(
`The Angular Compiler requires TypeScript >=2.7.2 and <2.8.0 but ${ts.version} was found instead.`);
}