How do you declare a numeric enum in TypeScript?

TypeScript Associate Easy

TypeScript Associate — Easy

How do you declare a numeric enum in TypeScript?

Key points

  • Numeric enums in TypeScript assign sequential values by default
  • The correct syntax for declaring a numeric enum is enum Direction { Up, Down }
  • Each member of the enum is automatically assigned a numeric value

Ready to go further?

Related questions