I'm working on a Angular project, recently updated to Angular 6 from Angular 5.2.10. Before the upgrade everything works fine.
Now, every time I compile my code for production, although there is no errors whatsoever during compile time, I receive this error when running:
ReferenceError: must call super constructor before using |this| in Ti class constructor
The only typescript class that use super is
export class Exception extends Error {
private _statusCode: number;
constructor(statusCode: number, type: ExceptionType) {
super(ExceptionType[type]);
this._statusCode = statusCode;
}
get statusCode(): number {
return this._statusCode;
}
}
Simple and plain. ExceptionType is an Enum.
The error is pretty self explanatory, but it seems I did the right thing, because Error class constructor has a single, optional parameter
Error(errorMsg?:string)
and this is called after the 'super' thing.
I'm numb.
Edit: tried the suggestion from comments, not working for me
Edit 2: as @estus pointed out, the error is not in this code but in
class Ei {
constructor(l, n=Ei.now) {
this.SchedulerAction = l,
this.now = n
}
schedule(l, n=0, e) {
return new this.SchedulerAction(this,l).schedule(e, n)
}
}
Ei.now = Date.now ? Date.now : ()=>+new Date;
class Ti extends Ei {
constructor(l, n=Ei.now) {
this.actions = [],
this.active = !1,
this.scheduled = void 0
}
...
}
The affected row is
this.actions = []
Which has nothing to do with my code. I'll open a issue on github.
Edit 3: please check https://github.com/angular/angular-cli/issues/7799#issuecomment-386582136