Provide extension option to enable strictTemplates (override compiler options from tsconfig)
See original GitHub issueWith the release of v12, the Ivy-based Language Service became the default. With that, the information provided by the extension follows what the application has configured the compiler to interpret (see Alex’s blog post for more information on why this was done). As a result, developers upgrading from previous versions that have apps which do not have strict templates enabled often experience a loss of information from the extension. It also may not be feasible for large projects to enable strictTemplates
immediately due to an abundance of new errors that would need to be fixed.
This feature request is to provide an extension option to override the project’s angularCompilerOptions
. This would allow the language service to enable strictTemplates
.
Importantly, this would likely result in the language service producing diagnostics that are not produced when running/compiling the application. However, this may still be a more ideal state than the current experience (which would be simply not getting any useful information for lots of locations in the template which require stricter type checking options).
Issue Analytics
- State:
- Created 2 years ago
- Reactions:8
- Comments:14
We’ve decided to add the option to the extension. It’ll be available in the v14 release.
I’m working on a codebase that was built prior to Angular 13, but has since been upgraded. As a result, we didn’t have
strictTemplates
set in our tsconfig. Enabling it would result in errors that would block our builds.Obviously, the ideal is to get those errors addressed; but in the meantime, that would mean not getting the full benefit of the Angular VS Code extension.
I discovered a workaround, however, that seems to convince the extension to perform strict template checks, while not blocking the builds:
strictTemplates: true
.strictTemplates: false
.Thus far, this has given me the best of both worlds and I’ve not noticed any issues (knock on wood). But, your mileage may vary of course.
Not sure if this should be possible with the extension, but I wanted to share it in case it helps out anyone else. 😄