Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Exclude or include angular components for strictTemplates check

I have a legacy code that has disabled strictTemplates in angularCompilerOptions. I want to turn on strictTemplates for some components to refactor components one after another.

I tried to create multiple tsConfig files but at the end compiler does not recognize exculded or included files. Is there any way to explicitly exclude or include some components from strictTemplates?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

There is no configuration for that currently.

Docs Reference – Template Type Checking


You can start with

Basic Mode – Template Type Checking

In the most basic type-checking mode, with the fullTemplateTypeCheck flag set to false, Angular validates only top-level expressions in a template.


After you are done with this you can perform a commit, then move on to the below step.


Full Mode – Template Type Checking

If the fullTemplateTypeCheck flag is set to true, Angular is more aggressive in its type-checking within templates. In particular:

  • Embedded views (such as those within an *ngIf or *ngFor) are checked
  • Pipes have the correct return type
  • Local references to directives and pipes have the correct type (except for any generic parameters, which will be any)

If you want to take it a step further after this, you can follow the docs for

Strict mode – Template Type Checking

Angular maintains the behavior of the fullTemplateTypeCheck flag, and introduces a third "strict mode". Strict mode is a superset of full mode, and is accessed by setting the strictTemplates flag to true. This flag supersedes the fullTemplateTypeCheck flag.


Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading