Last active
October 15, 2020 23:29
-
-
Save talesmgodois/1f5c83d34d30d0d88d6522660af8c036 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Os dois exemplos a seguir funcionam perfeitamente. | |
*/ | |
enum EBreeds { | |
AKITA = 'AKITA', | |
SCOTTISH_TERRIER = 'SCOTTISH_TERRIER' | |
} | |
enum EBreeds { | |
AKITA = 'Cão grande branco e peludo', | |
SCOTTISH_TERRIER = 'Cão pequeno' | |
} | |
/** | |
* O problema acontece a seguir | |
*/ | |
enum EBreeds { | |
AKITA = { | |
code: 'AKITA', | |
desc: 'Cão grande branco e peludo' | |
}, | |
SCOTTISH_TERRIER = { | |
code: 'SCOTTISH_TERRIER', | |
desc: 'Cão pequeno' | |
} | |
} | |
/** O seguinte erro ocorre | |
* Only numeric enums can have computed members, but this expression has type '{ code: string; desc: string; }'. | |
* If you do not need exhaustiveness checks, consider using an object literal instead.(18033) | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment