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

Typescript type hints fail when importing protobuf #523

Open
briggySmalls opened this issue Apr 4, 2019 · 0 comments
Open

Typescript type hints fail when importing protobuf #523

briggySmalls opened this issue Apr 4, 2019 · 0 comments

Comments

@briggySmalls
Copy link

briggySmalls commented Apr 4, 2019

I have tried to switch from using improbable-eng/grpc-web for typescript hints, to this repo. As far as I can see, the type hinting doesn't support protobuf definitions that import other protobuf definitions.

The issue can be reproduced with the following minimal protobuf examples:

// file: a.proto

syntax = "proto3";

package a;

// Import the other protobuf
import "b.proto";

service AService {
    rpc GetInfo (b.BRequest) returns (b.BResponse);
}
// file: b.proto

syntax = "proto3";

package b;

message BRequest {
}

message BResponse {
}

Then running the command:

protoc \
	-I . \
	--js_out=import_style=commonjs:. \
	--grpc-web_out=import_style=commonjs+dts,mode=grpcwebtext:. \
	a.proto b.proto

Results in all the correct files being produced. However the imports in the type information file incorrectly target a.proto for the messages defined in b.proto:

// a_grpc_web_pb.d.ts

...
import {
  BRequest,
  BResponse} from './a_pb';
...

p.s. Thanks for the most awesome tool 🙏

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

No branches or pull requests

2 participants