mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
build: support building with TypeScript 4.1 (#39571)
TypeScript 4.1 is now used to build and test within the repository. PR Close #39571
This commit is contained in:
committed by
Jessica Janiuk
parent
a7e7c211b5
commit
318255a5f8
@@ -48,6 +48,17 @@ const LOWER_FIELDS = ['useValue', 'useFactory', 'data', 'id', 'loadChildren'];
|
||||
*/
|
||||
const R3_LOWER_FIELDS = [...LOWER_FIELDS, 'providers', 'imports', 'exports'];
|
||||
|
||||
/**
|
||||
* Installs a handler for testing purposes to allow inspection of the temporary program.
|
||||
*/
|
||||
let tempProgramHandlerForTest: ((program: ts.Program) => void)|null = null;
|
||||
export function setTempProgramHandlerForTest(handler: (program: ts.Program) => void): void {
|
||||
tempProgramHandlerForTest = handler;
|
||||
}
|
||||
export function resetTempProgramHandlerForTest(): void {
|
||||
tempProgramHandlerForTest = null;
|
||||
}
|
||||
|
||||
const emptyModules: NgAnalyzedModules = {
|
||||
ngModules: [],
|
||||
ngModuleByPipeOrDirective: new Map(),
|
||||
@@ -618,6 +629,9 @@ class AngularCompilerProgram implements Program {
|
||||
}
|
||||
|
||||
const tmpProgram = ts.createProgram(rootNames, this.options, this.hostAdapter, oldTsProgram);
|
||||
if (tempProgramHandlerForTest !== null) {
|
||||
tempProgramHandlerForTest(tmpProgram);
|
||||
}
|
||||
const sourceFiles: string[] = [];
|
||||
const tsFiles: string[] = [];
|
||||
tmpProgram.getSourceFiles().forEach(sf => {
|
||||
|
||||
Reference in New Issue
Block a user