Skip to content

ReactiveForms: AbstractControl.parent could be undefined #16999

@snerks

Description

@snerks

I'm submitting a ... (check one with "x")

[ x ] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question

Current behavior

AbstractControl.parent is defined as returning FormGroup | FormArray.

However, it will return undefined, unless set.
It should probably be null for a "root" FormGroup.

Expected behavior

AbstractControl.parent is defined as returning FormGroup | FormArray | null.

Minimal reproduction of the problem with instructions

What is the motivation / use case for changing the behavior?

To accurately define the contract for AbstractControl.parent.

Please tell us about your environment:

  • Angular version: 4.1.3
  • Browser: [ all ]
  • Language: [ TypeScript 2.3.2 | ES5]

  • Node (for AoT issues): node --version =

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions