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
Although enums are both numbers and strings, it's not possible to use a type like this:
enumValues{A,B,C}typeValuesConstraint={[index: Values]: string;// An index signature parameter type must be 'string' or 'number'}constMapped: ValuesConstraint={[Values.A]: 'Alpha',[Values.B]: 'Beta',[Values.C]: 'Gamma'}constf=Mapped[Values.C]// f: any
Tried to use in as in [index in Values] but it says Type 'Values' is not assignable to type 'string'. Trying to use a type ValuesType = Values.A | Values.B | Values.C also doesn't work, is there any workaround?
The text was updated successfully, but these errors were encountered:
Although enums are both numbers and strings, it's not possible to use a type like this:
Tried to use
in
as in[index in Values]
but it saysType 'Values' is not assignable to type 'string'
. Trying to use atype ValuesType = Values.A | Values.B | Values.C
also doesn't work, is there any workaround?The text was updated successfully, but these errors were encountered: