Typescript 2.4.2 and Angular 5 - "Class extends value undefined is not a constructor or null"

1k views Asked by At

I updated to Angular 5.0.2, which requires Typescript 2.4.2. I now get this error when trying to compile:

TypeError: Class extends value undefined is not a constructor or null

From my research this seems to be a circular dependency issue but I am unsure how to solve it. I have a large number of models that extend a base model. For example (in pseudo-code):

In base-model.ts

export class BaseModel {
    public name: string;
}

In foo-model.ts

import {BaseModel} from './base-model';

export class FooModel extends BaseModel {}

In bar-model.ts

import {BaseModel} from './base-model';
import {FooModel} from './foo-model';

export class BarModel extends BaseModel {
    public foo: FooModel;
}

In index.ts

export * from './base-model';
export * from './foo-model';
export * from './bar-model';

In bar.component.ts

import {BarModel} from './index';

@Component({})
export class BarComponent {
    public bar: BarModel;
}

I have gone through all the suggestions in Angular's Update Guide for advanced projects (https://angular-update-guide.firebaseapp.com).

There were no compile errors while I was using Angular 4.4.4 and Typescript 2.3.4. What has changed to cause this problem?

0

There are 0 answers