NG.II · Angular 22 practice question

In `linkedSignal<Product[], Product | null>({ source, computation })` when using the `previous` parameter, what do the first and second generic type arguments represent?

const active = linkedSignal<Product[], Product | null>({
  source: this.products,
  computation: (list, previous) =>
    list.find(p => p.id === previous?.value?.id) ?? list[0] ?? null,
});
Choose one answer
Check answer and explanation

Correct answer: The first is the type of `source`, and the second is the output type of `computation`.

Explanation

In `linkedSignal<S, D>`, the first generic type argument matches the type of `source`, and the second determines the output type returned by `computation`.

Common trap

Reversing the order puts the computation output first, which causes type mismatches against `source`. `linkedSignal` does not take an error type as its second generic parameter.

Source: Angular docs: Dependent state with `linkedSignal` — Accounting for previous state
Checked against the cited text on 2026-11-27.

Report an error in this question