From dc655262be1406c5b0968ec006a31d2b1d982465 Mon Sep 17 00:00:00 2001
From: Alan Agius <alan.agius4@gmail.com>
Date: Thu, 1 Apr 2021 10:35:27 +0200
Subject: [PATCH]  refactor(compiler): remove TypeScript 4.0 program reuse
 check (#41406)

We no longer support TS 4.0, hence this check is redundant.

PR Close #41406
---
 packages/compiler-cli/src/transformers/program.ts | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/packages/compiler-cli/src/transformers/program.ts b/packages/compiler-cli/src/transformers/program.ts
index f82477b43a..ca50688a50 100644
--- a/packages/compiler-cli/src/transformers/program.ts
+++ b/packages/compiler-cli/src/transformers/program.ts
@@ -668,10 +668,7 @@ class AngularCompilerProgram implements Program {
     // - we cache all the files in the hostAdapter
     // - new new stubs use the exactly same imports/exports as the old once (we assert that in
     // hostAdapter.updateGeneratedFile).
-    // TS 4.1+ stores the reuse state in the new program
-    const checkReuseProgram =
-        (ts.versionMajorMinor as string) === '4.0' ? tmpProgram : this._tsProgram;
-    if (tsStructureIsReused(checkReuseProgram) !== StructureIsReused.Completely) {
+    if (tsStructureIsReused(this._tsProgram) !== StructureIsReused.Completely) {
       throw new Error(`Internal Error: The structure of the program changed during codegen.`);
     }
   }