Which @angular/* package(s) are relevant/related to the feature request?
core
Description
If you don't return anything from the computed signal, no one will complain about it. There will be no compilation or runtime errors.
It is, however, likely a mistake which will lead to incorrect behavior.
user = signal({
firstName: 'Lightning',
lastName: 'McQueen',
});
fullName = computed(() => {
// Oops, I forgot to add return
`${this.user().firstName} ${this.user().lastName}`;
});
Proposed solution
I cannot think of a legitimate reason not to return anything from the computed signal, so it seems like it should be typed to exclude void from the list of types it accepts.
Alternatives considered
@typescript-eslint/no-unused-expressions can help, but it only catches simple cases.
Which @angular/* package(s) are relevant/related to the feature request?
core
Description
If you don't return anything from the
computedsignal, no one will complain about it. There will be no compilation or runtime errors.It is, however, likely a mistake which will lead to incorrect behavior.
Hi, {{ fullName() }},Proposed solution
I cannot think of a legitimate reason not to return anything from the computed signal, so it seems like it should be typed to exclude
voidfrom the list of types it accepts.Alternatives considered
@typescript-eslint/no-unused-expressionscan help, but it only catches simple cases.