✳flâneur — a map of the web's best reading
TypeScript: Handbook - Enums
typescriptlang.org · 2,430 words · saved by 1 readers
How TypeScript enums work
Enums are one of the few features TypeScript has which is not a type-level extension of JavaScript. Enums allow a developer to define a set of named constants. Using enums can make it easier to document intent, or create a set of distinct cases. TypeScript provides both numeric and string-based enums. Numeric enums We’ll first start off with numeric enums, which are probably more familiar if you’re coming from other languages. An enum can be defined using the enum keyword. ts enum Direction { Up = 1 , Down , Left , Right , } Try Above, we have a numeric enum where Up is initialized with 1 . Al
Explore this link on the map →related reading
- Basic TypeScriptweb.mit.edu
- Defining an Enum - The Rust Programming Languagedoc.rust-lang.org
- Reading 2: Basic TypeScriptweb.mit.edu
- TypeScript: Documentation - The Basicstypescriptlang.org
- TypeScript: Documentation - TypeScript 3.7typescriptlang.org
- Everything is Fertilenickcammarata.com
- TypeScript: Documentation - Object Typestypescriptlang.org
- TypeScript: Documentation - TypeScript for the New Programmertypescriptlang.org
- Reading 12: Defining ADTs with Interfaces, Generics, Enums, and Functionsweb.mit.edu
- TypeScript: Documentation - Classestypescriptlang.org
- Reading 8: Defining ADTs with Interfaces, Generics, Enums, and Functionsweb.mit.edu
- Reading 1: Static Checkingweb.mit.edu