class Block{
// // Implements about block. internal.
blockProperties: Object;
constructor(){
this.applyBlockPrototype();
}
applyBlockPrototype(): void{
this.blockProperties = new Object();
}
}
If you have this code, you can't compile blockProperties because it's not initialized, and the IDE also comes straight out as a red line.
But it's the same logic, and there's no error.
class Block{
// // Implements about block. internal.
blockProperties: Object;
constructor(){
this.blockProperties = new Object();
}
}
What on earth did I do wrong?
typescript constructor
© 2024 OneMinuteCode. All rights reserved.