Skip to content

Strange error message when accessing undefined property of an enumΒ #61431

@Sainan

Description

@Sainan

πŸ”Ž Search Terms

enum, property, does not exist

πŸ•— Version & Regression Information

Tested 5.8.2

⏯ Playground Link

https://www.typescriptlang.org/play/?#code/KYOwrgtgBAymCWAXAzlA3gKClAEgUQEEAlAFRigF4oBGDAXwwGMB7EZZgG2ADoPmBzABRwkybjAAKBACJ4YASgDcQA

πŸ’» Code

enum Suits {
  HEARTS = 1
}
console.log(Suits.SPADES);

πŸ™ Actual behavior

Property 'SPADES' does not exist on type 'typeof Suits'.

πŸ™‚ Expected behavior

  • Property 'SPADES' does not exist on type 'Suits'
  • Property 'SPADES' does not exist on enum 'Suits'

Additional information about the issue

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Not a DefectThis behavior is one of several equally-correct options

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions