So I\'m getting the above error in the console. It\'s caused by _super
being undefined when it\'s passed to __extends
(in the generated .js>
Incurred in this error today. Not sure what was the OP scenario, but in my team's case we had:
dependencies.ts
)Uncaught TypeError: Cannot read property 'prototype' of undefined
__extends
function on the last line of another class, in another file (say client.ts
), importing those as dependenciesIn code:
// dependencies.ts
import { Injectable } from 'angular2/core';
@Injectable()
export class LocalStorageService extends BaseStorageService {
constructor() {
super(localStorage);
}
}
class BaseStorageService {
constructor(private storage: Storage) {}
// ...
}
and:
// client.ts
import { Injectable } from 'angular2/core';
import { LocalStorageService } from './dependencies';
@Injectable()
export class AuthStorageService {
constructor(private permanentStorage: LocalStorageService) { }
// ...
} // <-- call stack pointed here with inner '__extends' function
Problem solved by defining base class before derived class. After a quick search & read, this seems related to known (and unresolved?) TypeScript issues, e.g. #21 and #1842.
HTH