-
Notifications
You must be signed in to change notification settings - Fork 26.2k
Compiler should error on unknown structural directives #37322
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
Comments
Changing this from a feature request to a bug. Also removing the breaking changes label because this would have been an error at run-time already. |
Interestingly, |
Please, is is possible to extend this issue to any attribute directive ? Found this comment : #40664 (comment), which says that was a duplicated issue with this one. For example: No compiler error, even with |
Om my god, it's still opened? These issues make any refactoring unbearable and extremely risky. And yet Angular team decided to focus on bells and whistles instead. Well good luck. |
Stopping by to "revive" the issue. Still facing up this problem in 2024 with Angular 15. |
Still valid for Angular 17. |
Are there any updates on this issue? I am still facing this problem where unknown structural directives are not detected at compile time. It just manifests as an error in the console at runtime. It certainly makes refactoring much riskier than it ought to be. |
Same here with angular 18. This is a big problem for big applications with thousands of components. We can't retest every single view for every use cases of the app. The compiler must catch this. If it's not, please make this a top priority 🙏. |
Running into this when refactoring into standalone components. We do have extended diagnostics that will detect if known control flow directives imports are missing but not custom ones. The diagnostic that detects unused structural directive imports in component definitions does work on custom directives. Is this something you would accept a PR on? |
Note: The new extended diagnostic will be shipped in 19.2 (scheduled for 2nd half of Febuary) |
…lar#59443) Adds a new diagnostic that ensures that a standalone component using custom structural directives in a template has the necessary imports for those directives. Fixes angular#37322 PR Close angular#59443
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Adds a new diagnostic that ensures that a standalone component using custom structural directives in a template has the necessary imports for those directives. Fixes angular#37322
Adds a new diagnostic that ensures that a standalone component using custom structural directives in a template has the necessary imports for those directives. Fixes angular#37322
Issue an warning when compiling a template that do not match an structural directive selector.
Relevant Package
This feature request is for @angular/core
Description
The compiler completely ignore an selector like *myStructuralDirective without warning if it do not match any directive. This turns difficult to see that we are doing something wrong.
Describe the solution you'd like
If the selector in the template for an structural directive do not match any directive, show an warning about possible wrong usage.
Describe alternatives you've considered
I don't see alternatives.
The text was updated successfully, but these errors were encountered: