feat(compiler-cli): add support for using TypeScript 4.1 (#39571)
This change enables projects to be built with TypeScript 4.1. Support for TypeScript 4.0 is also retained. PR Close #39571
This commit is contained in:
parent
2786292780
commit
a7e7c211b5
|
@ -654,7 +654,10 @@ class AngularCompilerProgram implements Program {
|
||||||
// - we cache all the files in the hostAdapter
|
// - 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
|
// - new new stubs use the exactly same imports/exports as the old once (we assert that in
|
||||||
// hostAdapter.updateGeneratedFile).
|
// 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.`);
|
throw new Error(`Internal Error: The structure of the program changed during codegen.`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ const MIN_TS_VERSION = '4.0.0';
|
||||||
* Note: this check is disabled in g3, search for
|
* Note: this check is disabled in g3, search for
|
||||||
* `angularCompilerOptions.disableTypeScriptVersionCheck` config param value in g3.
|
* `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
|
* The currently used version of TypeScript, which can be adjusted for testing purposes using
|
||||||
|
|
Loading…
Reference in New Issue