Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

extends @Input property from Base class won't work properly with ivy #33274

Closed
yusuke-oba1 opened this issue Oct 20, 2019 · 2 comments
Closed

Comments

@yusuke-oba1
Copy link

馃悶 bug report

Affected Package

The issue is caused by package @angular/core

Is this a regression?

No

Description

I have defined Input binding in the base class in some cases. The sample code is like below.

export class Base {
  @Input() text: string;
}

@Component({
  selector: 'app-test',
  templateUrl: './test.component.html',
  styleUrls: ['./test.component.scss']
})
export class TestComponent extends Base {
  constructor() {
    super();
  }
}

And, binding this 'text' input with appComponent

<app-test [text]="'ivy test'"></app-test>

With enable ivy, it causes compiler error on startup.

ERROR in src/app/app.component.html:1:11 - error TS8002: Can't bind to 'text' since it isn't a known property of 'app-test'.
1. If 'app-test' is an Angular component and it has 'text' input, then verify that it is part of this module.
2. If 'app-test' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.
3. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component.

1 <app-test [text]="'ivy test'"></app-test>
            ~~~~~~~~~~~~~~~~~~~

  src/app/app.component.ts:5:16
    5   templateUrl: './app.component.html',
                     ~~~~~~~~~~~~~~~~~~~~~~
    Error occurs in the template of component AppComponent.

If Ivy is not enabled, the compiler will not cause an error.

馃敩 Minimal Reproduction

git clone https://github.com/yusuke-oba1/ivy-test
cd ivy-test
npm install
npm start

馃實 Your Environment

Angular Version:

Angular CLI: 9.0.0-next.12
Node: 10.14.1
OS: darwin x64
Angular: 9.0.0-next.12
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.900.0-next.12
@angular-devkit/build-angular     0.900.0-next.12
@angular-devkit/build-optimizer   0.900.0-next.12
@angular-devkit/build-webpack     0.900.0-next.12
@angular-devkit/core              9.0.0-next.12
@angular-devkit/schematics        9.0.0-next.12
@ngtools/webpack                  9.0.0-next.12
@schematics/angular               9.0.0-next.12
@schematics/update                0.900.0-next.12
rxjs                              6.5.3
typescript                        3.6.4
webpack                           4.41.1
@JoostK
Copy link
Member

JoostK commented Oct 20, 2019

Thanks for reporting, however this is a duplicate of #30080, please follow that one!

@JoostK JoostK closed this as completed Oct 20, 2019
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Nov 20, 2019
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

2 participants