Skip to content
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

Improve on extended diagnostics for signal invocation #55883

Open
undsoft opened this issue May 20, 2024 · 2 comments
Open

Improve on extended diagnostics for signal invocation #55883

undsoft opened this issue May 20, 2024 · 2 comments
Assignees
Labels
area: compiler Issues related to `ngc`, Angular's template compiler cross-cutting: signals state: has PR
Milestone

Comments

@undsoft
Copy link

undsoft commented May 20, 2024

Which @angular/* package(s) are relevant/related to the feature request?

No response

Description

#49657 ensures that signals are called in situations like:

{{ mySignal }}

However, there are other cases where it's easy to make a mistake, especially when migrating from old @Inputs.
The following cases produce no warnings:

<div *ngIf="mySignal"></div>
<div [class.red]="mySignal"></div>
<div [attr.data-something]="mySignal"></div>
<input [disabled]="mySignal">

While it's possible to write code where statements above are valid, I would argue that it's likely a mistake and that compiler should warn about those cases.
If we don't want to add this functionality to Angular, I can create a ticket in angular-eslint.

Proposed solution

Extended diagnostics should warn when signals are not called in additional scenarios.

Alternatives considered

Creating this ticket in angular-eslint repo :)

@eneajaho
Copy link
Contributor

Related #54324

@devversion
Copy link
Member

devversion commented May 21, 2024

We improved this, as per link of @eneajaho. In addition, I have a some backburner work to enable type checking for DOM properties as well. This would catch issues like this even without the extended diagnostic.

Keeping this open to track the root problem: DOM type checking not enabled by default.

@devversion devversion self-assigned this May 21, 2024
@devversion devversion added state: has PR area: compiler Issues related to `ngc`, Angular's template compiler cross-cutting: signals labels May 21, 2024
@ngbot ngbot bot modified the milestone: needsTriage May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: compiler Issues related to `ngc`, Angular's template compiler cross-cutting: signals state: has PR
Projects
None yet
Development

No branches or pull requests

3 participants