fix(compiler-cli): remove leftover _extendedTemplateDiagnostics requirements (#44777)

Refs #42966.

There were two remaining places where `_extendedTemplateDiagnostics` needed to be set which should have been removed in #44712 but got missed. This updates them to only require `strictTemplates` and not `_extendedTemplateDiagnostics` so the feature is properly enabled in production.

PR Close #44777
This commit is contained in:
Doug Parker
2022-01-20 10:32:24 -08:00
committed by Andrew Kushnir
parent 4e180cb43b
commit 197f3f4a26
2 changed files with 10 additions and 6 deletions
@@ -446,7 +446,7 @@ export class NgCompiler {
diagnostics.push(
...this.getNonTemplateDiagnostics().filter(diag => diag.file === file),
...this.getTemplateDiagnosticsForFile(file, optimizeFor));
if (this.options._extendedTemplateDiagnostics) {
if (this.options.strictTemplates) {
diagnostics.push(...this.getExtendedTemplateDiagnostics(file));
}
return this.addMessageTextDetails(diagnostics);
@@ -460,7 +460,7 @@ export class NgCompiler {
const ttc = compilation.templateTypeChecker;
const diagnostics: ts.Diagnostic[] = [];
diagnostics.push(...ttc.getDiagnosticsForComponent(component));
if (this.options._extendedTemplateDiagnostics) {
if (this.options.strictTemplates) {
const extendedTemplateChecker = compilation.extendedTemplateChecker;
diagnostics.push(...extendedTemplateChecker.getDiagnosticsForComponent(component));
}
@@ -384,7 +384,7 @@ describe('getSemanticDiagnostics', () => {
expect(diags[0].category).toEqual(ts.DiagnosticCategory.Warning);
});
it('should not produce invalid banana in box warning without the required flags', () => {
it('should not produce invalid banana in box warning without `strictTemplates`', () => {
const files = {
'app.ts': `
import {Component} from '@angular/core';
@@ -397,7 +397,9 @@ describe('getSemanticDiagnostics', () => {
}
`
};
const project = createModuleAndProjectWithDeclarations(env, 'test', files);
const project = createModuleAndProjectWithDeclarations(env, 'test', files, {
strictTemplates: false,
});
const diags = project.getDiagnosticsForFile('app.ts');
expect(diags.length).toEqual(0);
@@ -426,7 +428,7 @@ describe('getSemanticDiagnostics', () => {
expect(diags[0].category).toEqual(ts.DiagnosticCategory.Warning);
});
it('should not produce invalid banana in box warning in external html file without the required flags',
it('should not produce invalid banana in box warning in external html file without `strictTemplates`',
() => {
const files = {
'app.ts': `
@@ -441,7 +443,9 @@ describe('getSemanticDiagnostics', () => {
`,
'app.html': `<div ([foo])="bar"></div>`
};
const project = createModuleAndProjectWithDeclarations(env, 'test', files);
const project = createModuleAndProjectWithDeclarations(env, 'test', files, {
strictTemplates: false,
});
const diags = project.getDiagnosticsForFile('app.html');
expect(diags.length).toEqual(0);