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

Ng 8 + ivy: Component inheritance binding error #30754

Closed
runner78 opened this issue May 30, 2019 · 8 comments
Closed

Ng 8 + ivy: Component inheritance binding error #30754

runner78 opened this issue May 30, 2019 · 8 comments

Comments

@runner78
Copy link

馃悶 bug report

Affected Package

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

Is this a regression?

It work when not using Ivy.

Description

馃敩 Minimal Reproduction

Abstract class

export abstract class AbstractComponent {
  @Input() value: string;
}

Component

export class ChildComponent extends AbstractComponent {
}

It works with
<dum-child value="test"></dum-child>

Create an error:
<dum-child [value]="'test'"></dum-child>

馃敟 Exception or Error

ERROR in __ng_typecheck__.ts(34,10): error TS2339: Property 'value' does not exist on type 'HTMLElement'.

馃實 Your Environment

Angular Version:

Angular CLI: 8.0.0
Node: 10.16.0
OS: darwin x64
Angular: 8.0.0
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.800.0
@angular-devkit/build-angular     0.800.0
@angular-devkit/build-optimizer   0.800.0
@angular-devkit/build-webpack     0.800.0
@angular-devkit/core              8.0.0
@angular-devkit/schematics        8.0.0
@ngtools/webpack                  8.0.0
@schematics/angular               8.0.0
@schematics/update                0.800.0
rxjs                              6.4.0
typescript                        3.4.5
webpack                           4.30.0

Anything else relevant?

@JoostK
Copy link
Member

JoostK commented May 30, 2019

Thanks for reporting. Inheritance should be supported in the template type checker, as long as the base class is statically known (it should't be some dynamically computed expression). In this case however, it looks like the problem is that the base class is not declared in an NgModule, which currently means its metadata (the details on inputs, outputs etc.) cannot be retrieved. This metadata is required for template type-checking purposes, so that's where the false positive originates. We'll have to revisit this machinery a bit to fix the issue.

@JoostK
Copy link
Member

JoostK commented May 30, 2019

I should mention that you should be able to workaround the issue by disabling the template type checker. In tsconfig.app.json, you'll have to set "fullTemplateTypeCheck": false under "angularCompilerOptions".

@JoostK
Copy link
Member

JoostK commented May 30, 2019

Tracked in FW-1352

@runner78
Copy link
Author

I have tried now "fullTemplateTypeCheck": false but has no effect, same error.

@kemsky
Copy link

kemsky commented May 31, 2019

The same error was reported here #30080.

@JoostK
Copy link
Member

JoostK commented May 31, 2019

@kemsky Thanks for linking. Yes, your issue has the same root cause, only now do I understand what is happening exactly.

@kara
Copy link
Contributor

kara commented Jun 3, 2019

Seems like we should close this as a duplicate of #30080 so we can track progress / comments in one place. Thanks for reporting @runner78, please follow #30080

@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 Sep 15, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants