You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 29, 2021. It is now read-only.
// Enum-like type and definition example.typeGender='male'|'female';constGenders={MALE: 'male'asGender,FEMALE: 'female'asGender,};
@prop({enum: Object.values(Genders)})gender?: Gender;
However we have string enum support in TS now. It would be nice if the decorator function accept also the object type as the enum value and get the string values using Object.values(object) inside:
So the signature of the BasePropOptions would be enum?: string[]|object; and you can in runtime check if Array.isArray(enum) to behave like now or convert enum object to values.
The text was updated successfully, but these errors were encountered:
Right now, you support string array as an enum:
However we have string enum support in TS now. It would be nice if the decorator function accept also the
object
type as theenum
value and get the string values usingObject.values(object)
inside:So the signature of the
BasePropOptions
would beenum?: string[]|object;
and you can in runtime check ifArray.isArray(enum)
to behave like now or convert enum object to values.The text was updated successfully, but these errors were encountered: