Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

Type AbstractControl is not assignable to type FormGroup #4250

Closed
ghost opened this issue Oct 27, 2018 · 1 comment
Closed

Type AbstractControl is not assignable to type FormGroup #4250

ghost opened this issue Oct 27, 2018 · 1 comment

Comments

@ghost
Copy link

ghost commented Oct 27, 2018

I am using PyCharm and "tslint": "^5.11.0". tslint complains about the following.

Building a form using FormBuilder:

this.menuForm = this._formBuilder.group({
      form: this._formBuilder.group(this.menu.form)
    });

and later assigning this to

const form: FormGroup = this.menuForm.get('form');

will give

Type AbstractControl is not assignable to type FormGroup

despite

export declare class FormGroup extends AbstractControl

Is that my fault or is tslint doing something wrong?

@ghost
Copy link
Author

ghost commented Oct 27, 2018

Ok nvm - You have to upcast: const form = <FormGroup> this.menuForm.get('form');

@ghost ghost closed this as completed Oct 27, 2018
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants