feat: add support for typescript 3.2 (#27536)

https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-2.html
https://blogs.msdn.microsoft.com/typescript/2018/11/29/announcing-typescript-3-2/

Any application using tsickle for closure compatibility will need to update it's tsickle
dependency to 0.34

PR Close #27536
This commit is contained in:
Igor Minar
2018-12-06 23:01:08 -08:00
committed by Miško Hevery
parent b04bc5d06c
commit 17e702bf8b
13 changed files with 200 additions and 34 deletions

View File

@ -24,10 +24,10 @@
},
"peerDependencies": {
"@angular/compiler": "0.0.0-PLACEHOLDER",
"typescript": ">=3.1.1 <3.2"
"typescript": ">=3.1.1 <3.3"
},
"engines" : {
"node" : ">=8.0"
"engines": {
"node": ">=8.0"
},
"repository": {
"type": "git",
@ -49,4 +49,4 @@
"ng-update": {
"packageGroup": "NG_UPDATE_PACKAGE_GROUP"
}
}
}

View File

@ -8,11 +8,12 @@
import {dirname} from 'canonical-path';
import {existsSync, writeFileSync} from 'fs';
import {mkdir, mv} from 'shelljs';
import * as ts from 'typescript';
import {DecorationAnalyzer} from '../analysis/decoration_analyzer';
import {CompiledFile, DecorationAnalyzer} from '../analysis/decoration_analyzer';
import {NgccReferencesRegistry} from '../analysis/ngcc_references_registry';
import {PrivateDeclarationsAnalyzer} from '../analysis/private_declarations_analyzer';
import {SwitchMarkerAnalyzer} from '../analysis/switch_marker_analyzer';
import {ExportInfo, PrivateDeclarationsAnalyzer} from '../analysis/private_declarations_analyzer';
import {SwitchMarkerAnalyses, SwitchMarkerAnalyzer} from '../analysis/switch_marker_analyzer';
import {Esm2015ReflectionHost} from '../host/esm2015_host';
import {Esm5ReflectionHost} from '../host/esm5_host';
import {NgccReflectionHost} from '../host/ngcc_host';
@ -23,6 +24,7 @@ import {FileInfo, Renderer} from '../rendering/renderer';
import {EntryPoint} from './entry_point';
import {EntryPointBundle} from './entry_point_bundle';
/**
* A Package is stored in a directory on disk and that directory can contain one or more package
* formats - e.g. fesm2015, UMD, etc. Additionally, each package provides typings (`.d.ts` files).
@ -96,7 +98,8 @@ export class Transformer {
}
}
analyzeProgram(reflectionHost: NgccReflectionHost, isCore: boolean, bundle: EntryPointBundle) {
analyzeProgram(reflectionHost: NgccReflectionHost, isCore: boolean, bundle: EntryPointBundle):
ProgramAnalyses {
const typeChecker = bundle.src.program.getTypeChecker();
const referencesRegistry = new NgccReferencesRegistry(reflectionHost);
const decorationAnalyzer = new DecorationAnalyzer(
@ -120,3 +123,10 @@ export class Transformer {
writeFileSync(file.path, file.contents, 'utf8');
}
}
interface ProgramAnalyses {
decorationAnalyses: Map<ts.SourceFile, CompiledFile>;
switchMarkerAnalyses: SwitchMarkerAnalyses;
privateDeclarationsAnalyses: ExportInfo[];
}

View File

@ -79,7 +79,7 @@ const MIN_TS_VERSION = '3.1.1';
* ∀ supported typescript version v, v < MAX_TS_VERSION
* MAX_TS_VERSION is not considered as a supported TypeScript version
*/
const MAX_TS_VERSION = '3.2.0';
const MAX_TS_VERSION = '3.3.0';
class AngularCompilerProgram implements Program {
private rootNames: string[];