Angular4 Components inheritance with abstract class : <p>I want to define a base class for my components to share some features. So i've began with :</p>

<pre><code>export abstract class BaseComponent {
    protected getName(): string;
}

@Component(...)
export class MyComponent extends BaseComponent {
    protected getName(): string {
        return "MyComponent";
    }
}
</code></pre>

<p>But after i needed to add some annotations to BaseComponent like <code>@HostListener('window:keydown', ['$event'])</code>. So i had to add <code>@Component</code> to <code>BaseComponent</code> to enable angular annotations. Everything was good... Until i tried to compile in production mode with </p>

<blockquote>
  <p>ng build --prod</p>
</blockquote>

<p>:</p>

<blockquote>
  <p>Cannot determine the module for class BaseComponent</p>
</blockquote>

<p>So i've added <code>BaseComponent</code> to <code>@NgModule</code>, but i had :</p>

<blockquote>
  <p>No template specified for component BaseComponent</p>
</blockquote>

<p>So i've added </p>

<pre><code>@Component({template: ''})
</code></pre>

<p>But i had :</p>

<blockquote>
  <p>Argument of type 'typeof BaseComponent' is not assignable to parameter of type 'Type'. Cannot assign an abstract constructor type to a non-abstract constructor type.</p>
</blockquote>

<p>So i had remove the "<code>abstract</code>" keyword to compile in production mode my project.</p>

<p>Do you have a solution? <strong>I dislike bad conception!</strong></p>
