NG.II · Angular 22 practice question

A developer writes a `linkedSignal` whose `computation` callback reads the `previous` parameter. What must the developer provide to satisfy TypeScript typing for this `linkedSignal` call?

const selected = linkedSignal<string[], string>({
  source: this.options,
  computation: (opts, previous) => previous?.value ?? opts[0],
});
Choose one answer
Check answer and explanation

Correct answer: Explicit generic type arguments on `linkedSignal`.

Explanation

When `computation` uses the `previous` parameter, TypeScript requires explicit generic type arguments on `linkedSignal` so it can type both the source and the computed output.

Common trap

Angular does not have a `@SignalType` decorator for typing signals. The `linkedSignal` options object does not accept a `fallbackType` property.

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