feat(ivy): verify whether TypeScript version is supported (#33377)

During the creation of an Angular program in the compiler, a check is
done to verify whether the version of TypeScript is considered
supported, producing an error if it is not. This check was missing in
the Ivy compiler, so users may have ended up running an unsupported
TypeScript version inadvertently.

Resolves FW-1643

PR Close #33377
This commit is contained in:
JoostK
2019-10-24 20:24:39 +02:00
committed by Andrew Kushnir
parent 09a2bb839f
commit 4aa51b751b
6 changed files with 147 additions and 73 deletions

View File

@ -11,6 +11,7 @@ import * as ts from 'typescript';
import * as api from '../transformers/api';
import {nocollapseHack} from '../transformers/nocollapse_hack';
import {verifySupportedTypeScriptVersion} from '../typescript_support';
import {ComponentDecoratorHandler, DirectiveDecoratorHandler, InjectableDecoratorHandler, NgModuleDecoratorHandler, NoopReferencesRegistry, PipeDecoratorHandler, ReferencesRegistry} from './annotations';
import {BaseDefDecoratorHandler} from './annotations/src/base_def';
@ -74,6 +75,10 @@ export class NgtscProgram implements api.Program {
constructor(
rootNames: ReadonlyArray<string>, private options: api.CompilerOptions,
private host: api.CompilerHost, oldProgram?: NgtscProgram) {
if (!options.disableTypeScriptVersionCheck) {
verifySupportedTypeScriptVersion();
}
if (shouldEnablePerfTracing(options)) {
this.perfTracker = PerfTracker.zeroedToNow();
this.perfRecorder = this.perfTracker;