Suppose I have a User class and I want to instantiate only predefined 'status'. Is this the optimal approach? Are there any other alternatives? What is the correct way to achieve this? Thank you in advance.
export class User {
constructor(
username: string,
email: string,
status: AccountStatus
){}
}
export enum AcountStatus {
Active = 'Active',
Suspended = 'Suspended'
}
import { User } from 'app/models/user.model'
import { AccountStatus } from 'app/models/user.model'
private user: User;
this.user = new User('username', '<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="f580869087b580869087db9698">[email protected]</a>', AccountStatus.Active)