refactor(ivy): let strictTemplates imply fullTemplateTypeCheck (#34195)

Previously, it was required that both `fullTemplateTypeCheck` and
`strictTemplates` had to be enabled for strict mode to be enabled. This
is strange, as `strictTemplates` implies `fullTemplateTypeCheck`. This
commit makes setting the `fullTemplateTypeCheck` flag optional so that
strict mode can be enabled by just setting `strictTemplates`.

PR Close #34195
This commit is contained in:
JoostK
2019-12-02 21:39:11 +01:00
committed by Alex Rickabaugh
parent 2e82357611
commit e116816131
3 changed files with 22 additions and 20 deletions

View File

@ -462,9 +462,15 @@ export class NgtscProgram implements api.Program {
}
private getTemplateDiagnostics(): ReadonlyArray<ts.Diagnostic> {
// Determine the strictness level of type checking based on compiler options. As
// `strictTemplates` is a superset of `fullTemplateTypeCheck`, the former implies the latter.
// Also see `verifyCompatibleTypeCheckOptions` where it is verified that `fullTemplateTypeCheck`
// is not disabled when `strictTemplates` is enabled.
const strictTemplates = !!this.options.strictTemplates;
const fullTemplateTypeCheck = strictTemplates || !!this.options.fullTemplateTypeCheck;
// Skip template type-checking if it's disabled.
if (this.options.ivyTemplateTypeCheck === false &&
this.options.fullTemplateTypeCheck !== true) {
if (this.options.ivyTemplateTypeCheck === false && !fullTemplateTypeCheck) {
return [];
}
@ -475,8 +481,7 @@ export class NgtscProgram implements api.Program {
// First select a type-checking configuration, based on whether full template type-checking is
// requested.
let typeCheckingConfig: TypeCheckingConfig;
if (this.options.fullTemplateTypeCheck) {
const strictTemplates = !!this.options.strictTemplates;
if (fullTemplateTypeCheck) {
typeCheckingConfig = {
applyTemplateContextGuards: strictTemplates,
checkQueries: false,