Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Typescript - how to define a property with Enum?
Message
 
 
À
Tous
Information générale
Forum:
Javascript
Catégorie:
Autre
Titre:
Typescript - how to define a property with Enum?
Divers
Thread ID:
01680854
Message ID:
01680854
Vues:
32
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
Répondre
Fil
Voir

Click here to load this message in the networking platform