Can someone assist me in resolving an error in my code?
export class BSPTree {
leaf: Box;
lchild: undefined;
rchild: undefined;
constructor(leaf: Box){
this.leaf = leaf;
}
getLeafs(){
if (this.lchild === undefined && this.rchild === undefined)
return [this.leaf]
else
return [].concat(this.lchild.getLeafs(), this.rchild.getLeafs())
}
I'm puzzled as to why this error keeps occurring. Any insights?