Open
Description
What version of protobuf and what language are you using?
Version: master/v3.18
Language: Javascript
What operating system (Linux, Windows, ...) and version? Linux
What runtime / compiler are you using (e.g., python version or gcc version) Nodejs
What did you do?
Steps to reproduce the behavior:
- Trying to export type
map<K, V>
so I created aproto
file like this:
message MessageResponse {
string _id = 1;
string title = 2;
bool disabled = 3;
map<string,string> metadata = 4;
}
- Converting it using this some commands like this:
protoc -I=/libraries/protos/ /libraries/protos/src/*.proto /libraries/protos/src/**/*.proto --plugin=/libraries/protos/binaries/linux/protoc-gen-grpc-web --js_out=import_style=commonjs,binary:/libraries/protos/build/typescript --grpc-web_out=import_style=typescript,mode=grpcwebtext:/libraries/protos/build/typescript --experimental_allow_proto3_optional
- What I am getting on
.ts
files is something like:
export namespace MessageResponse {
export type AsObject = {
id: string,
title: string,
disabled: boolean,
metadataMap: Array<[string, string]>,
}
}
- Well we can see there is a suffix called
Map
added to my field name! also the generated type isArray<[string, string]>
. but what we were expecting, based on language guide here, where an object of{"k": v, …}
, likeRecord<string, V>
What did you expect to see
An object like: Record<string, string>
What did you see instead?
Array<[string, string]>