`Symbol.iterator in FieldTree` is always false

Open Beginner friendly
#70,252 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
angular, typescript
Domain
frontend

Research direction

Start in packages/forms/signals/src/field/proxy.ts at the linked proxy handler and inspect how FieldTree responds to property-presence checks versus property access. Verify that the provided TypeScript example recognizes Symbol.iterator and can traverse the FieldTree, while preserving the existing iterator behavior.

Written by the indexing model from the issue text.

Description

area: forms forms: signals
Which @angular/* package(s) are the source of the bug?

forms

Is this a regression?

No

Description

I want to traverse a FieldTree<unknown>. A typesafe check for iterability requires checking for presence of Symbol.iterator field:

if (Symbol.iterator in fieldTree && typeof fieldTree[Symbol.iterator] === 'function') {
  for (const [k, v] of fieldTree) {
      // ...
  }
}

However the field proxy doesn't implement has handler, therefore Symbol.iterator is reported as missing, even though it's returned by get handler:
https://github.com/angular/angular/blob/46d2cb7ff049dc4549080f64dceb1541b3a87cee/packages/forms/signals/src/field/proxy.ts#L67

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

Please provide the environment you discovered this bug in (run ng version)
"@angular/forms": "^22.1.0",
Anything else?

No response

Dominant language
TypeScript
Stars
101k
Forks
28.1k
Avg merge
1d 18h
Merged PRs (30d)
254

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from angular/angular

All issues in angular/angular

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.