Skip to content

feat(extension): Add option to force strict templates #1646

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 3, 2022

Conversation

atscott
Copy link
Collaborator

@atscott atscott commented May 3, 2022

This feature request is to provide an extension option to override the project's
angularCompilerOptions. This would allow the language service to enable strictTemplates.

With 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.

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).

resolves #1418

@atscott atscott added the target: minor This PR is targeted for the next minor release label May 3, 2022
alxhub
alxhub previously approved these changes May 3, 2022
@atscott atscott added the action: merge Ready to merge label May 3, 2022
This feature request is to provide an extension option to override the project's
`angularCompilerOptions`. This would allow the language service to enable `strictTemplates`.

With 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](https://blog.angular.io/under-the-hood-of-the-language-service-ab763c26f522)
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.

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).

resolves angular#1418
@atscott atscott force-pushed the enableStrictTemplatesOption branch from 261e230 to cb3cf2d Compare May 3, 2022 20:40
@atscott atscott requested a review from alxhub May 3, 2022 21:07
@atscott atscott merged commit 17fdb9e into angular:main May 3, 2022
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Jun 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge Ready to merge target: minor This PR is targeted for the next minor release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provide extension option to enable strictTemplates (override compiler options from tsconfig)
2 participants