ts-protoc-gen
ts-protoc-gen copied to clipboard
"google.protobuf.NullValue" from "google/protobuf/struct.proto" is not supported
Versions of relevant software used
[email protected] [email protected] @types/[email protected]
What happened
Generate wrong TypeScript definition, because google_protobuf_struct_pb.NullValueMap doesn't exist:
import * as jspb from "google-protobuf";
import * as google_protobuf_struct_pb from "google-protobuf/google/protobuf/struct_pb";
export class MyMessage extends jspb.Message {
getValue(): google_protobuf_struct_pb.NullValueMap[keyof google_protobuf_struct_pb.NullValueMap];
setValue(value: google_protobuf_struct_pb.NullValueMap[keyof google_protobuf_struct_pb.NullValueMap]): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): MyMessage.AsObject;
static toObject(includeInstance: boolean, msg: MyMessage): MyMessage.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: MyMessage, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): MyMessage;
static deserializeBinaryFromReader(message: MyMessage, reader: jspb.BinaryReader): MyMessage;
}
export namespace MyMessage {
export type AsObject = {
value: google_protobuf_struct_pb.NullValueMap[keyof google_protobuf_struct_pb.NullValueMap],
}
}
What you expected to happen
Generate right TypeScript definition.
If use the following proto:
syntax = "proto3";
enum NullValue {
NULL_VALUE = 0;
}
message MyMessage {
oneof kind {
NullValue value = 1;
}
}
it will generate right definition:
import * as jspb from "google-protobuf";
export class MyMessage extends jspb.Message {
hasValue(): boolean;
clearValue(): void;
getValue(): NullValueMap[keyof NullValueMap];
setValue(value: NullValueMap[keyof NullValueMap]): void;
getKindCase(): MyMessage.KindCase;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): MyMessage.AsObject;
static toObject(includeInstance: boolean, msg: MyMessage): MyMessage.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: MyMessage, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): MyMessage;
static deserializeBinaryFromReader(message: MyMessage, reader: jspb.BinaryReader): MyMessage;
}
export namespace MyMessage {
export type AsObject = {
value: NullValueMap[keyof NullValueMap],
}
export enum KindCase {
KIND_NOT_SET = 0,
VALUE = 1,
}
}
export interface NullValueMap {
NULL_VALUE: 0;
}
export const NullValue: NullValueMap;
How to reproduce it (as minimally and precisely as possible):
syntax = "proto3";
import "google/protobuf/struct.proto";
message MyMessage {
google.protobuf.NullValue value = 1;
}
Full logs to relevant components
Anything else we need to know
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.
I have experienced the same issue recently.