TS2475
error TS2475: ‘const’ enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment or type query.
Broken Code ❌
1 |
|
Fixed Code ✔️
Defining a const enum
prevents TypeScript from generating JavaScript code for this enum. With const enum
TypeScript will just assume that the JavaScript equivalent of this code is already present.
If you want that TypeScript creates JS code for your enum definition, then you have to remove the const
keyword:
1 |
|