docs: document that linkedSignal with previous should include type arguments (#60857)

Due to the cyclic nature of `previous`'s type and the computation's return type,
TypeScript isn't able to infer generic type arguments.

Closes #60423

PR Close #60857
This commit is contained in:
JoostK
2025-04-13 19:12:21 +02:00
committed by kirjs
parent c5ca597aeb
commit 6b9434a029
@@ -108,6 +108,8 @@ The `source` can be any signal, such as a `computed` or component `input`. When
The `computation` is a function that receives the new value of `source` and a `previous` object. The `previous` object has two properties— `previous.source` is the previous value of `source`, and `previous.value` is the previous result of the `computation`. You can use these previous values to decide the new result of the computation.
HELPFUL: When using the `previous` parameter, it is necessary to provide the generic type arguments of `linkedSignal` explicitly. The first generic type corresponds with the type of `source` and the second generic type determines the output type of `computation`.
## Custom equality comparison
`linkedSignal`, as any other signal, can be configured with a custom equality function. This function is used by downstream dependencies to determine if that value of the `linkedSignal` (result of a computation) changed: