Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Typescript - how to define a property with Enum?
Message
 
 
To
All
General information
Forum:
Javascript
Category:
Other
Title:
Typescript - how to define a property with Enum?
Miscellaneous
Thread ID:
01680854
Message ID:
01680854
Views:
31
Hi everybody,

I have a relatively simple question and I remember I was learning it before, but I already forgot [BTW, I could not find typescript here anywhere or just Angular (not AngularJS) to ask my question].

Anyway, here is a simple question: how do I define a typescript interface with, say, status property that only allows 2 values ("active" and "inactive"). I can, of course, simply define this property as a string, but I want to also somehow add that this string can only take few values.

I tried to search for an answer, I found ways to declare enum in typescript, but I don't see how should I implement it as a property.

Hope it's a simple question and I hope I'll get an answer.

Thanks in advance.
If it's not broken, fix it until it is.


My Blog
Reply
Map
View

Click here to load this message in the networking platform