Repository: angular/angular
File: packages/core/src/render3/reactivity/linked_signal.ts (TypeScript)

Code before:
 * @license
 * Copyright Google LLC All Rights Reserved.
 *
 * Use of this source code is governed by an MIT-style license that can be
 * found in the LICENSE file at https://angular.dev/license
 */

import {
  ComputationFn,
  createLinkedSignal,
  LinkedSignalGetter,
  LinkedSignalNode,
  linkedSignalSetFn,
  linkedSignalUpdateFn,
  SIGNAL,
} from '../../../primitives/signals';
import {Signal, ValueEqualityFn} from './api';
import {signalAsReadonlyFn, WritableSignal} from './signal';

const identityFn = <T>(v: T) => v;

/**
 * Creates a writable signal whose value is initialized and reset by the linked, reactive computation.
 *
 * @see [Dependent state with linkedSignal](guide/signals/linked-signal)
 *
 * @publicApi 20.0
 */
export function linkedSignal<D>(
  computation: () => D,
  options?: {equal?: ValueEqualityFn<NoInfer<D>>; debugName?: string},
): WritableSignal<D>;

/**
 * Creates a writable signal whose value is initialized and reset by the linked, reactive computation.
 * This is an advanced API form where the computation has access to the previous value of the signal and the computation result.
 *
 * Note: The computation is reactive, meaning the linked signal will automatically update whenever any of the signals used within the computation change.
 *
 * @publicApi 20.0
 * @see [Dependent state with linkedSignal](guide/signals/linked-signal)
 */
export function linkedSignal<S, D>(options: {
  source: () => S;
  computation: (source: NoInfer<S>, previous?: {source: NoInfer<S>; value: NoInfer<D>}) => D;
  equal?: ValueEqualityFn<NoInfer<D>>;
  debugName?: string;
}): WritableSignal<D>;

export function linkedSignal<S, D>(
  optionsOrComputation:

Review comment (suggestion):
I would only add the `@see` on the implementation itself (not the overloads). It should be enough to add the link to the doc page 

Code after:
 * @license
 * Copyright Google LLC All Rights Reserved.
 *
 * Use of this source code is governed by an MIT-style license that can be
 * found in the LICENSE file at https://angular.dev/license
 */

import {
  ComputationFn,
  createLinkedSignal,
  LinkedSignalGetter,
  LinkedSignalNode,
  linkedSignalSetFn,
  linkedSignalUpdateFn,
  SIGNAL,
} from '../../../primitives/signals';
import {Signal, ValueEqualityFn} from './api';
import {signalAsReadonlyFn, WritableSignal} from './signal';

const identityFn = <T>(v: T) => v;

/**
 * Creates a writable signal whose value is initialized and reset by the linked, reactive computation.
 *
 * @publicApi 20.0
 */
export function linkedSignal<D>(
  computation: () => D,
  options?: {equal?: ValueEqualityFn<NoInfer<D>>; debugName?: string},
): WritableSignal<D>;

/**
 * Creates a writable signal whose value is initialized and reset by the linked, reactive computation.
 * This is an advanced API form where the computation has access to the previous value of the signal and the computation result.
 *
 * Note: The computation is reactive, meaning the linked signal will automatically update whenever any of the signals used within the computation change.
 *
 * @publicApi 20.0
 * @see [Dependent state with linkedSignal](guide/signals/linked-signal)
 */
export function linkedSignal<S, D>(options: {
  source: () => S;
  computation: (source: NoInfer<S>, previous?: {source: NoInfer<S>; value: NoInfer<D>}) => D;
  equal?: ValueEqualityFn<NoInfer<D>>;
  debugName?: string;
}): WritableSignal<D>;

export function linkedSignal<S, D>(
  optionsOrComputation:
    | {
        source: () => S;