/
githubmirror
/
angular
Обзор
Документация
Войти
/
githubmirror
/
angular
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
packages/forms/signals/src/field/util.ts
34 строки
1022 B
Alex Rickabaugh
fix(forms): memoize reads of child fields in signal forms (#65802)
03 дек 2025, 23:52
03 дек 2025, 23:52
b96f65a
Код
Авторство
О чём код?
/** * @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 type {FieldNodeOptions} from './structure'; /** A shortCircuit function for reduceChildren that short-circuits if the value is false. */ export function shortCircuitFalse(value: boolean): boolean { return !value; } /** A shortCircuit function for reduceChildren that short-circuits if the value is true. */ export function shortCircuitTrue(value: boolean): boolean { return value; } /** Recasts the given value as a new type. */ export function cast<T>(value: unknown): asserts value is T {} /** * A helper method allowing to get injector regardless of the options type. * @param options */ export function getInjectorFromOptions(options: FieldNodeOptions) { if (options.kind === 'root') { return options.fieldManager.injector; } return options.parent.structure.root.structure.injector; }