feat: add support for TypeScript 3.3 (and drop older versions) (#29004)

https://blogs.msdn.microsoft.com/typescript/2019/01/31/announcing-typescript-3-3/

BREAKING CHANGE: TypeScript 3.1 and 3.2 are no longer supported.

Please update your TypeScript version to 3.3

PR Close #29004
This commit is contained in:
Igor Minar
2019-02-02 01:02:16 -08:00
committed by Kara Erickson
parent 9a7f5601fa
commit 75748d6044
21 changed files with 59 additions and 167 deletions

View File

@ -72,14 +72,14 @@ const defaultEmitCallback: TsEmitCallback =
* Minimum supported TypeScript version
* ∀ supported typescript version v, v >= MIN_TS_VERSION
*/
const MIN_TS_VERSION = '3.1.1';
const MIN_TS_VERSION = '3.3.3333';
/**
* Supremum of supported TypeScript versions
* ∀ supported typescript version v, v < MAX_TS_VERSION
* MAX_TS_VERSION is not considered as a supported TypeScript version
*/
const MAX_TS_VERSION = '3.3.0';
const MAX_TS_VERSION = '3.4.0';
class AngularCompilerProgram implements Program {
private rootNames: string[];
@ -463,14 +463,14 @@ class AngularCompilerProgram implements Program {
// Match behavior of tsc: only produce emit diagnostics if it would block
// emit. If noEmitOnError is false, the emit will happen in spite of any
// errors, so we should not report them.
if (this.options.noEmitOnError === true) {
if (emitResult && this.options.noEmitOnError === true) {
// translate the diagnostics in the emitResult as well.
const translatedEmitDiags = translateDiagnostics(this.hostAdapter, emitResult.diagnostics);
emitResult.diagnostics = translatedEmitDiags.ts.concat(
this.structuralDiagnostics.concat(translatedEmitDiags.ng).map(ngToTsDiagnostic));
}
if (!outSrcMapping.length) {
if (emitResult && !outSrcMapping.length) {
// if no files were emitted by TypeScript, also don't emit .json files
emitResult.diagnostics =
emitResult.diagnostics.concat([createMessageDiagnostic(`Emitted no files.`)]);
@ -506,7 +506,7 @@ class AngularCompilerProgram implements Program {
});
}
const emitEnd = Date.now();
if (this.options.diagnostics) {
if (emitResult && this.options.diagnostics) {
emitResult.diagnostics = emitResult.diagnostics.concat([createMessageDiagnostic([
`Emitted in ${emitEnd - emitStart}ms`,
`- ${emittedUserTsCount} user ts files`,