Skip to content

Get a list with all values from an Enum #17198

@alex321

Description

@alex321

Feature:
If we have an Enum, add the ability to access all of it's values as a list (or any other iterable).

enum Colour { red = 'RED', green = 'GREEN' }

Colour.toList() === ['RED', 'GREEN']

We could have a separate call for the keys? Or vice versa?

It is quite useful as you'd frequently want to be able to iterate over them somehow. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    QuestionAn issue which isn't directly actionable in code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions