Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no set method TS types for proto3 Map field #312

Open
luffigo123 opened this issue Apr 24, 2023 · 0 comments
Open

no set method TS types for proto3 Map field #312

luffigo123 opened this issue Apr 24, 2023 · 0 comments

Comments

@luffigo123
Copy link

luffigo123 commented Apr 24, 2023

Hi everybody,
There is no set method of map filed on TS.

When a proto file has map field:
syntax = "proto3";

package example;

message Example
{
map<string, string> labels = 1;
}

It generates this TS definitions
export class Example extends jspb.Message {
getLabelsMap(): jspb.Map<string, string>;
clearLabelsMap(): void;

serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): Example.AsObject;
static toObject(includeInstance: boolean, msg: Example): Example.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: Example, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): Example;
static deserializeBinaryFromReader(message: Example, reader: jspb.BinaryReader): Example;
}

export namespace Example {
export type AsObject = {
labelsMap: Array<[string, string]>,
}
}

Note: No setLablesMap() method, @jonny-improbable could you take a look about this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant