Skip to content

Commit

Permalink
feat(compiler-cli): add support for using TypeScript 4.1 (#39571)
Browse files Browse the repository at this point in the history
This change enables projects to be built with TypeScript 4.1.  Support for TypeScript 4.0 is also retained.

PR Close #39571
  • Loading branch information
clydin authored and thePunderWoman committed Nov 25, 2020
1 parent 2786292 commit a7e7c21
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion packages/compiler-cli/src/transformers/program.ts
Expand Up @@ -654,7 +654,10 @@ 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).
if (tsStructureIsReused(tmpProgram) !== StructureIsReused.Completely) {
// 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) {
throw new Error(`Internal Error: The structure of the program changed during codegen.`);
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/compiler-cli/src/typescript_support.ts
Expand Up @@ -25,7 +25,7 @@ const MIN_TS_VERSION = '4.0.0';
* Note: this check is disabled in g3, search for
* `angularCompilerOptions.disableTypeScriptVersionCheck` config param value in g3.
*/
const MAX_TS_VERSION = '4.1.0';
const MAX_TS_VERSION = '4.2.0';

/**
* The currently used version of TypeScript, which can be adjusted for testing purposes using
Expand Down

0 comments on commit a7e7c21

Please sign in to comment.