Skip to content

enums showing double the amount of entries; "extra" key value pairs are the flipped versions of the original key-value pairsΒ #51481

Closed as not planned
@kptevpro

Description

@kptevpro

Bug Report

πŸ”Ž Search Terms

is:issue enum duplicate key value double extra entries flipped

πŸ•— Version & Regression Information

Found in v~4.7.2

⏯ Playground Link

Playground link with relevant code

πŸ’» Code

enum TransactionTypes {
    A = 1,
    B = 2,
    C = 3,
    D = 4,
    E = 5,
    F = 6,
    G = 7,
    H = 8,
}

console.log('Keys:' + Object.keys(TransactionTypes))
console.log('Values: ' + Object.values(TransactionTypes))

for(let i = 0; i < Object.keys(TransactionTypes).length; i++) {
    console.log(`Pair: ${Object.keys(TransactionTypes)[i]} - ${Object.values(TransactionTypes)[i]}`) 
}

πŸ™ Actual behavior

Enums shows double the amount of entries; shows key-value pairs twice where the second set (extra entries) are the original keys and values 'flipped'.

πŸ™‚ Expected behavior

Show key value pairs once; only one set of the key values declared.

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