I am facing an issue with transpiling the following TypeScript class:
class DataService {
styles: Object[];
selectedStyle: Object;
selectedChildStyle: Object;
constructor() {
this.styles = [{
"name": "Parent",
"child": {}
}];
this.selectedStyle = this.styles[0];
// THE BELOW LINES CAUSE AN ERROR
if (this.selectedStyle.child && this.selectedStyle.child.length)
this.selectedChildStyle = this.selectedStyle.child[0];
else
this.selectedChildStyle = null;
}
}
Whenever I try to run npm start
, the application fails to start and throws a strange error related to ELIFECYCLE
. This issue seems to occur when the last four lines are uncommented.