MCPcopy Index your code
hub / github.com/angular/angular / narrowed

Function narrowed

packages/forms/signals/test/node/recursive_logic.spec.ts:20–28  ·  view source on GitHub ↗
(
  fieldTree: FieldTree<TModel> | undefined,
  guard: (value: TModel) => value is TNarrowed,
)

Source from the content-addressed store, hash-verified

18}
19
20function narrowed<TModel, TNarrowed extends TModel>(
21 fieldTree: FieldTree<TModel> | undefined,
22 guard: (value: TModel) => value is TNarrowed,
23): Signal<FieldTree<TNarrowed> | undefined> {
24 return computed(
25 () =>
26 fieldTree && (guard(fieldTree().value()) ? (fieldTree as FieldTree<TNarrowed>) : undefined),
27 );
28}
29
30function isNonNull<T>(t: T): t is NonNullable<T> {
31 return t !== null;

Callers 1

Calls 3

computedFunction · 0.90
guardFunction · 0.85
valueMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…