I have a User class with a nested Address class. In the component I would like to initialize an object of type User with something like let user = new User() or let user:User.
But errors are thrown, because Angular/Typescript wants me to assign values. Is there an efficient way to do this, without assigning all the empty "" values to the object.
Below the classes:
class Address {
constructor(
public street: string,
public number: number,
public suffix: string,
public houseLetter: string,
public city: string,
public zipcode: string,
) { }
}
export class User {
constructor(
public id: number,
public firstName: string,
public lastName: string,
public email: string,
public address: Address,
) { }
}