Closed lztetreault-dev closed 8 months ago
I'm confused about how to generate a .ts file when I have two Protobufs and one imports a message from the first one.
project layout
project_root/ protos/ first.proto second.proto
The first file
syntax="proto3"; option go_package="project/thing"; import "google/protobuf/timestamp.proto"; message AType { string things = 1; }
The second file
syntax = "proto3"; option go_package="project/thing"; import "protos/first.proto"; message Something { types.AType thing = 1; }
I am able to generate the first file fine with
protoc -I=protos --ts_out=protos/typescript first.proto
but the second one complains about a bad import to the first one
protoc -I=protos --ts_out=protos/typescript second.proto
contact.proto:8:1: Import "protos/first.proto" was not found or had errors. contact.proto:17:9: "AType" is not defined.
I'm guessing I'm missing something in my command but I am not sure what.
-I=protos is the problem here. your imports should be relative to that. so instead of importing withprotos/first.proto use first.proto.
-I=protos
protos/first.proto
first.proto
I'm confused about how to generate a .ts file when I have two Protobufs and one imports a message from the first one.
project layout
The first file
The second file
I am able to generate the first file fine with
but the second one complains about a bad import to the first one
I'm guessing I'm missing something in my command but I am not sure what.