I am new to typescript and I am trying to create a "model" class.

The constructor should accept a list of properties (that come from the database), and any of them should be optional.

Here is the code so far:

```
export type UserRole = "admin" | "moderator" | "user" | "visitor";

export default class User{

    public id: number | null = null;
    public login: string = '';
    public email: string = '';
    public role: UserRole = 'visitor';
    ...

    constructor({id, login, email, role, ... }){
        this.id = id;
        this.login = login;
        this.email = email;
        this.role = role;
        ....
    }

```

As you can see, it doesn't look right. A lot of code is duplicated.
And if I want to make the properties optional it will duplicate even more code:(

Can anyone point me in the right direction? thanks