AoT: inheritance error not reported correctly
See original GitHub issueI’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 If a component extends a class with implemented lifecycle hooks, they’re not being called when building with aot (both in prod and dev). It’s alright though when running ng build --prod --aot=false
Expected behavior Lifecycle hooks inheritance should be working
Minimal reproduction of the problem with instructions
import { Component, OnInit } from '@angular/core';
class Foo implements OnInit {
ngOnInit() {
alert('Foo initialized');
}
}
@Component({
selector: 'app-root',
template: 'App works',
})
export class AppComponent extends Foo {}
What is the motivation / use case for changing the behavior?
Please tell us about your environment: Windows 10
- Angular version: 4.0.3
-
Browser: any
-
Language: TypeScript 2.3.0
-
Node (for AoT issues):
node --version= 7.8.0
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Angular compiler options
When true , the compiler does not look at the TypeScript version and does not report an error when an unsupported version of...
Read more >Avoid compile-time static initialization of classes when using ...
I'm working on a project using Clojure and RoboVM. We use AOT compilation to compile Clojure to JVM classes, and then use RoboVM...
Read more >Attack on Titan's Final Chapter Has DESTROYED A Masterpiece
Attack on Titan's Ending was a Fumbling instead of Rumbling. Attack on Titan Final Chapter 139 has been extremely controversial with the ...
Read more >List of Error and Warning Messages - Microsoft Learn
Checks that the class name stated in the attribute of an upgrade script exists in the AOT. BPErrorClassNameNotFound, @SYS309404. Method %1 in ...
Read more >The pipe 'async' could not be found - Stack Overflow
@NgModule.declarations aren't inherited by child modules. If you need pipes, directives, components from a module, the module should be ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

The is an error condition that is not being reported
ngcnor by TypeScript as, by default, the"declaration"option isfalse.An exported class must only extend exported classes. To have TypeScript report this case, change the
"declaration"option totruein yourtsconfig.jsonfile.To fix this in your code, add
exportin front of the declaration ofFoo.I am keeping this open as a bug because we should report this as an error in
ngceven if TypeScript allows it.REPO:
git clone https://github.com/chuckjaz/e16335.gitcd e16335yarnng build --aotExpected: Error report that
Foois not exported. Received: Compiled successfully but produced incorrect code (“App works: not initialized” instead of “App works: initialized”).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.