Skip to content

Property 'controlLabel' does not exist on type 'AbstractControl'. Due to using Ivy! #36810

@Pieter-1337

Description

@Pieter-1337

🐞 bug report

Affected Package

The issue is caused by package @angular/....

Not with certainty

Is this a regression?

Yes, the previous version in which this bug was not present was: ....

Yes: In Angular 8 this issue was not present

Description

When building a form with Reactive Forms I decided to use an extension on FormControl to add a property "controlLabel" to my formControls, In Version 8 of Angular this works with no problem, however in Angular 9 when I try to read the extra property on my extended class It, the app will not compile and I will receive an error as followed:

ERROR in apps/reactive-forms/src/app/forms/form-with-state-matcher/form-with-state-matcher.component.html:2:12 - error TS2339: Property 'controlLabel' does not exist on type 'AbstractControl'.

{{form.controls['name'].controlLabel}}

🔬 Minimal Reproduction

https://stackblitz.com/edit/angular-jg9tyw?file=src%2Fapp%2Fapp.component.ts

I Noticed here that turning off the "Use Ivy" flag in the StackBlitz settings tab solves the problem

🔥 Exception or Error




Error in src/app/app.component.html (2:10)
Property 'controlLabel' does not exist on type 'AbstractControl'.

🌍 Your Environment

Angular Version:




Angular CLI: 9.1.0
Node: 10.13.0
OS: win32 x64

Angular: 9.1.1
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Ivy Workspace: Yes

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.901.0
@angular-devkit/build-angular     0.901.0
@angular-devkit/build-optimizer   0.901.0
@angular-devkit/build-webpack     0.901.0
@angular-devkit/core              9.1.0
@angular-devkit/schematics        9.1.0
@angular/.cdk.MODULES             
@angular/cdk                      9.2.1
@angular/cli                      9.1.0
@angular/material                 9.2.1
@ngtools/webpack                  9.1.0
@schematics/angular               9.1.0
@schematics/update                0.901.0
rxjs                              6.5.5
typescript                        3.8.3
webpack                           4.42.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions