MCPcopy Create free account
hub / github.com/angular/angular / readonly

Function readonly

packages/forms/signals/src/api/rules/readonly.ts:44–58  ·  view source on GitHub ↗
(
  path: SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>,
  configOrLogic?:
    | {when?: NoInfer<LogicFn<TValue, boolean, TPathKind>>}
    | NoInfer<LogicFn<TValue, boolean, TPathKind>>,
)

Source from the content-addressed store, hash-verified

42): void;
43
44export function readonly<TValue, TPathKind extends PathKind = PathKind.Root>(
45 path: SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>,
46 configOrLogic?:
47 | {when?: NoInfer<LogicFn<TValue, boolean, TPathKind>>}
48 | NoInfer<LogicFn<TValue, boolean, TPathKind>>,
49): void {
50 assertPathIsCurrent(path);
51
52 const pathNode = FieldPathNode.unwrapFieldPath(path);
53
54 const logic =
55 typeof configOrLogic === 'function' ? configOrLogic : (configOrLogic?.when ?? (() => true));
56
57 pathNode.builder.addReadonlyRule(logic);
58}

Callers 6

TestCmpClass · 0.90
readonly.spec.tsFile · 0.90
TestCmpClass · 0.85
field_node.spec.tsFile · 0.85
submit.spec.tsFile · 0.85
compat.spec.tsFile · 0.85

Calls 3

assertPathIsCurrentFunction · 0.90
unwrapFieldPathMethod · 0.80
addReadonlyRuleMethod · 0.45

Tested by

no test coverage detected