angularangular-compiler

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?


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:


    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.