Have an issue.
While assigning enum value to the enum attribute, getting an error: Type 'string' is not assignable to type 'CountryCode'.
Which i suppose i shouldn't get cause both attribute and value are the same enum type
service with enum attribute:
@Injectable()
export class UserData {
private _country_code: CountryCode;
private _currency_code: CurrencyCode;
constructor() { }
get country_code(): CountryCode {
return this._country_code;
}
set country_code(value: CountryCode) {
this._country_code = value;
}
get currency_code(): CurrencyCode {
return this._currency_code;
}
set currency_code(value: CurrencyCode) {
this._currency_code = value;
}
}
enum
export enum CountryCode {
TH,
BGD,
}
usage case with an error:
this.userData.country_code = CountryCode[data.country_code];