Permalink
Browse files

feat(compiler-cli): Check unvalidated combination of ngc and TypeScri…

…pt (#22293)

closes #20669

PR Close #22293
  • Loading branch information...
wKoza authored and vicb committed Dec 2, 2017
1 parent 28b23f9 commit 3ceee99e22a3fa7af4853b05362f1a9e1b291cfe
@@ -60,6 +60,7 @@ export interface CompilerOptions extends ts.CompilerOptions {
i18nInFile?: string;
i18nInMissingTranslations?: 'error'|'warning'|'ignore';
preserveWhitespaces?: boolean;
disableTypeScriptVersionCheck?: boolean;
}
export interface CompilerHost extends ts.CompilerHost {
@@ -132,6 +132,9 @@ export interface CompilerOptions extends ts.CompilerOptions {
// position.
disableExpressionLowering?: boolean;
// Disable TypeScript Version Check.
disableTypeScriptVersionCheck?: boolean;
// Locale of the application
i18nOutLocale?: string;
// Export format (xlf, xlf2 or xmb)
@@ -71,10 +71,11 @@ class AngularCompilerProgram implements Program {
rootNames: ReadonlyArray<string>, private options: CompilerOptions,
private host: CompilerHost, oldProgram?: Program) {
this.rootNames = [...rootNames];
const [major, minor] = ts.version.split('.');
Number(major) > 2 || (Number(major) === 2 && Number(minor) >= 4) ||
userError('The Angular Compiler requires TypeScript >= 2.4.');
if (ts.version < '2.4.2' || (ts.version >= '2.7.0' && !options.disableTypeScriptVersionCheck)) {
throw new Error(
`The Angular Compiler requires TypeScript >=2.4.2 and <2.7 but ${ts.version} was found instead.`);
}
this.oldTsProgram = oldProgram ? oldProgram.getTsProgram() : undefined;
if (oldProgram) {

0 comments on commit 3ceee99

Please sign in to comment.