Skip to content

Enum Problem #51150

Closed
Closed
@louiss0

Description

@louiss0

Bug Report

🔎 Search Terms

🕗 Version & Regression Information

  • This is a crash
  • This changed between versions ______ and _______
  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about _________
  • I was unable to test this on prior versions because _______

⏯ Playground Link

Playground link with relevant code

https://www.typescriptlang.org/play?#code/KYOwrgtgBAYg9nKBvAsAKCpqBxBATAGnSygCEBDQ9AX3XQGM4QBnOAG2ADoBzAJzjAAHABQAiAKLhoAdwCWAFwAWUAPIAjAFbB68qAGtgAT2aiAlOnVadnA8eHw4pzgDM4vceXqLhtgLwA+KEYWdi42OG5hJFtqU3M0YNYOHn4hSTxheIYmJK4+AREJKSg5JVVNbV0AN3I2MGATeMtKzhq6hvsEJ1d3T282+oCgnNDOcMikAeBYrISR5Py0kAzZxNHFwslIEoVlZp0oUHleWQazCwrrI5OOh263Dy9hYQBtWwIoKYBdUyHskOS4yi70+tXqMzocwBeVSgnSmXQQA

💻 Code

image

// We can quickly address your report if:
//  - The code sample is short. Nearly all TypeScript bugs can be demonstrated in 20-30 lines of code!
//  - It doesn't use external libraries. These are often issues with the type definitions rather than TypeScript bugs.
//  - The incorrectness of the behavior is readily apparent from reading the sample.
// Reports are slower to investigate if:
//  - We have to pare too much extraneous code.
//  - We have to clone a large repo and validate that the problem isn't elsewhere.
//  - The sample is confusing or doesn't clearly demonstrate what's wrong.

🙁 Actual behavior

When you iterate through enum keys you find that the keys are logged then the values of each key are logged as well when using Object.keys(). When you use Object.entries() you find that the keys and values on the original object are printed and then the values are printed as the keys and the keys printed as values. This all happens during the same iteration.

🙂 Expected behavior

I expected the keys and values to be logged when using Object.entries() . When I use Object.keys() i expect the keys to be logged not the values at all

Metadata

Metadata

Assignees

No one assigned

    Labels

    Working as IntendedThe behavior described is the intended behavior; this is not a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions