W
W
Wasya UK2020-09-01 14:28:41
typescript
Wasya UK, 2020-09-01 14:28:41

Is it possible to check for existence in an enum in typescript?

Whether it is possible to make the interface in which value will be checked for presence in enum? I don't know how to ask) Well... I have to pass exactly 1 value from enum to type (enemy type). Is it possible to do so?

export enum EnemiesTypes {
  BEAST = "BEAST",
  UNDEAD = "UNDEAD",
  FLYING = "FLYING",
  DRAGON = "DRAGON",
  FIEND = "FIEND",
  HUMANOID = "HUMANOID",
  MACHINE = "MACHINE",
  PLANT = "PLANT",
  FLAN = "FLAN",
  STONE = "STONE",
  HEAVY = "HEAVY"
};

export interface EnemyCharacteristics {
  type:  // что тут дописать?
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Yarkov, 2020-09-01
@dmc1989

export interface EnemyCharacteristics {
  type: EnemiesTypes
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question