I have an interface:
export interface Person {
firstName?: string;
lastName?: string;
status?: Status;
}
export enum Status {
Single,
Married,
Divorced
}
if I create a Person
Person john = {
firstName: "John",
lastName: "Smith",
status: Status.Married,
}
And I decide to access John's status by
var johnStatus = john.status;
I would get a number (1)
How do I make it so that I get the actual values (Single, Married, and Divorced) instead of a number? I am very new to typescript and it doesn't seem like there are a lot of info on this online. I tried adding keyword such as 'typeof' or 'keyof' but they don't work. Is there any other keywords I can use. Do I need to create a helper method? I will appreciate any help!