One question about Objects in JS ( typescript ). I have following code which works fine
myObj: { type: string } = { type: '' };
this.myObj.type = 'Abcd';
But i want this code to work
myObj: { type: string };
this.myObj.type = 'abcd'; // this.myObj['type'] = 'Abcd'; also not working
Why is it not working? What am i doing wrong? I am getting 'cannot set property type of null'