enumをconstで定義するとトランスパイル時は問題ないけど、実行時に参照すると上手くいかないらしい。 constとenumは合わせ技で使わないようにする。const使わず素直にexport enum Enum{}的に使うか。。。 例1 enumをconstで宣言すると、実行時には上手く読めない。
From TypeScript Handbook on Enums: Enums are one of the few features TypeScript has which is not a type-level extension of JavaScript. In other words, TypeScript enums have their corresponsing runtime ...
It is commonly used in all languages. Initial value starts from 0 if we do not set any value. Takes only numeric values. enum keyword is used to declare the numeric type enum. We can assign any value ...
enum(列挙型)は、意味のある定数の集合をひとつの型としてまとめるための構文です。 JavaやC#など静的型付け言語由来の機能で、TypeScriptでも同様に使われます。
Enums, short for Enumerations, are preset constants that can be defined by a developer for use elsewhere in the code. For Javascript developers, the concept of enums is usually new, but they are ...
一部の結果でアクセス不可の可能性があるため、非表示になっています。
アクセス不可の結果を表示する