[Pas2js] Enum as an const

Michael Van Canneyt michael at freepascal.org
Fri Jun 23 20:04:45 CEST 2023



On Fri, 23 Jun 2023, Henrique Gottardi Werlang via Pas2js wrote:

> It possible to convert an enumerator in a const string?
>
> For example I declare a enumerator:
>
> TMyEnumerator = (MyEnum1, MyEnum2, MyEnum3);
>
> In the generated JS file, it is possible do convert the enumerator value in a const string, like, "MyEnum1"?

The compiler actually generates the strings, see:

https://wiki.freepascal.org/Pas2js_Transpiler#Translating_enums

Michael.


More information about the Pas2js mailing list