improbable-eng / ts-protoc-gen

Protocol Buffers Compiler (protoc) plugin for TypeScript and gRPC-Web.
Apache License 2.0
1.36k stars 173 forks source link

Question: Why is map represented as Array in the object representation of a message? #229

Closed SebastianStehle closed 3 years ago

SebastianStehle commented 4 years ago

I think the title aready explains it.

I have a simpe message:

message UserDto {
    // Statistics counters.
    map<string, int64> counters = 8;
}

And the AsObject representation is:

export namespace UserDto {
  export type AsObject = {
    countersMap: Array<[string, number]>,
  }
}

What I don't understand:

e.g.

counters: { [key: string]: number };
Raiondesu commented 4 years ago

Absolutely valid complaint here. This goes against all semantic and sanity norms.

jonnyreeves commented 4 years ago

Agreed, however ts-protoc-gen supplies the typings for the google grpc library so it's not an issue we can resolve (unless I've missed something?) :(

On Tue, 18 Aug 2020 at 15:41, Alexey Iskhakov notifications@github.com wrote:

Absolutely valid complaint here. This goes against all semantic and sanity norms.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/improbable-eng/ts-protoc-gen/issues/229#issuecomment-675520191, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABQ36PWSSIFLYPK7BBNGEDSBKHKLANCNFSM4NE7JCLA .

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.