Skip to content

Add option to generate ES Maps for protobuf map fields #1031

Open
@JosephusPaye

Description

Greetings!

Protobuf-ES currently generates plain JS objects for protobuf map fields, instead of Map instances. The manual mentions that this was decided for compatibility with "popular libraries":

ECMAScript Map objects have great support for key types, but many popular libraries don't support them correctly yet. For this reason, we use an object to represent map fields.

Maps have been supported by browsers and other JS runtimes for a while now (roughly since 2015), and from personal experience, seem to be widely supported across the ecosystem.

Are there any plans to revisit this decision? Alternatively, could an option be added that can be set to generate maps instead of objects? Something similar to what is available for 64-bit ints, where strings can be generated instead of bigints.

Thanks!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    FeatureNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions