feat(ivy): introduce a flag to control template type-checking for Ivy (#29698)

Template type-checking is enabled by default in the View Engine compiler.
The feature in Ivy is not quite ready for this yet, so this flag will
temporarily control whether templates are type-checked in ngtsc.

The goal is to remove this flag after rolling out template type-checking in
google3 in Ivy mode, and making sure the feature is as compatible with the
View Engine implementation as possible.

Initially, the default value of the flag will leave checking disabled.

PR Close #29698
This commit is contained in:
Alex Rickabaugh
2019-04-02 11:52:19 -07:00
committed by Ben Lesh
parent 42262e4e8c
commit d9ce8a4ab5
4 changed files with 19 additions and 3 deletions

View File

@ -376,8 +376,9 @@ export class NgtscProgram implements api.Program {
}
private getTemplateDiagnostics(): ReadonlyArray<ts.Diagnostic> {
// Skip template type-checking unless explicitly requested.
if (this.options.fullTemplateTypeCheck !== true) {
// Skip template type-checking if it's disabled.
if (this.options.ivyTemplateTypeCheck === false &&
this.options.fullTemplateTypeCheck !== true) {
return [];
}

View File

@ -224,6 +224,17 @@ export interface CompilerOptions extends ts.CompilerOptions {
* Read more about this here: https://github.com/angular/angular/issues/25644.
*/
createExternalSymbolFactoryReexports?: boolean;
/**
* Turn on template type-checking in the Ivy compiler.
*
* This is an internal flag being used to roll out template type-checking in ngtsc. Turning it on
* by default before it's ready might break other users attempting to test the new compiler's
* behavior.
*
* @internal
*/
ivyTemplateTypeCheck?: boolean;
}
export interface CompilerHost extends ts.CompilerHost {