You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Which @angular/* package(s) are relevant/related to the feature request?
core
Description
During a talk from Manfred during NgConf an issue happened multiple times that could definitely be hard to figure out. Essentially there were two signals:
sig1 = signal(5)
sig2 = signal(2)
The idea was then to compare the unboxed values of these two signals, but by accident they were left unboxed like so:
if (this.sig1 > this.sig2)
seemingly this condition would never return true since two signals would never be <, <=, >, >= each other (although could be === ?)
This seems like a very easy mistake to make, especially since signals are so new. of course simply unboxing the two signals allows the correct logic to happen but it seems like any dev regardless of experience could take some time to figure out why their logic is not working correctly due to this.
Would it be possible to get error output for this similar to what happens when trying to compare two types that shouldnt be compared (like string and int)
Proposed solution
would be amazing to get some sort of similar error prompt that states something along the lines of:
"Operator '>' cannot be applied to types 'Signal' and 'Signal'"
Alternatives considered
Possibly we could also get an error similar to what happens in the template when we do @if(sig1) instead of @if(sig1()) that looks like This condition will always return false since signals cannot be compared in this way. Did you mean to call them instead?
The text was updated successfully, but these errors were encountered:
Which @angular/* package(s) are relevant/related to the feature request?
core
Description
During a talk from Manfred during NgConf an issue happened multiple times that could definitely be hard to figure out. Essentially there were two signals:
The idea was then to compare the unboxed values of these two signals, but by accident they were left unboxed like so:
seemingly this condition would never return true since two signals would never be <, <=, >, >= each other (although could be === ?)
This seems like a very easy mistake to make, especially since signals are so new. of course simply unboxing the two signals allows the correct logic to happen but it seems like any dev regardless of experience could take some time to figure out why their logic is not working correctly due to this.
Would it be possible to get error output for this similar to what happens when trying to compare two types that shouldnt be compared (like string and int)
Proposed solution
would be amazing to get some sort of similar error prompt that states something along the lines of:
"Operator '>' cannot be applied to types 'Signal' and 'Signal'"
Alternatives considered
Possibly we could also get an error similar to what happens in the template when we do
@if(sig1)
instead of@if(sig1())
that looks likeThis condition will always return false since signals cannot be compared in this way. Did you mean to call them instead?
The text was updated successfully, but these errors were encountered: