"typescript": "2.7.2"
How/WHY this code worked without any IDE error or --aot compile error on Angular 6 project?
private func1() {
const b: B = new B();
b.name = 'jack';
this.func2(b);
}
private func2(a: A) {
console.log(a.name); //prints jack
}
-
export class A {
public name: string;
}
export class B {
public name: string;
public surname: string;
}
different names? The value of the name property ? I really don't see where you're going, maybe you should state what is bothering you ;nametosurname, and you will see your IDE throws an error. And if you look at it, you will see that it says that objects don't match anymore (not classes, not values, not types, but plain objects)