Skip to content

Instantly share code, notes, and snippets.

@talesmgodois
Last active October 15, 2020 23:29
Show Gist options
  • Save talesmgodois/1f5c83d34d30d0d88d6522660af8c036 to your computer and use it in GitHub Desktop.
Save talesmgodois/1f5c83d34d30d0d88d6522660af8c036 to your computer and use it in GitHub Desktop.
/**
* 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