HN user

drk4

11 karma
Posts1
Comments9
View on HN

Mostly a frontend web developer, but with some backend and mobile experience as well. Looking for an interesting development position where I can do some cool stuff.

    Location: Portugal/Europe
    Remote: Yes
    Willing to relocate: Yes (within EU)
    Technologies: Typescript, javascript, react, swift, iOS, python, django
    Resume: via email
    Email: plferreira4@gmail.com
    Website/portfolio: https://nbpt.eu/ | https://bitbucket.org/drk4/
TypeScript 2.4 9 years ago

You mean because of using the same string for a key/value? I guess I see the potential problem. Anyway just think that it might be a bit confusing to have the enum work slightly different depending on whether its using numbers or strings. It can caught some people off guard.

TypeScript 2.4 9 years ago

That seems like a much minor situation compared to not being able to reverse map.

You could have a situation where you have a string as a code, and then the display name for example, and you can't really do that as is now. This seems more useful than checking for the type (which in a numeric enum is either a number or string, so you would still need to do some work to properly validate it).

TypeScript 2.4 9 years ago

The string enums don't seem to work the same way as the number enums, there's no 2 way access.

For example.

enum Test { a } let a = Test.a; let b = Test[ 0 ]; // isn't available on the string ones

I wonder why its like that.

Its always a tough decision, either you make no changes but then have to live with a less than ideal situation, or make changes but forces everyone to update their code.

Personally I think its ok to make incompatible changes once and then, as long as its not too many changes in one go (like python3), its preferable than later on ending up with inconsistent or overly complex languages.