Closed jinchi2013 closed 3 years ago
I'm using cmd below to generate the ts interface, basically I'm using the only types case.
only types
protoc --proto_path={search-path-of-my-protos} --plugin=./node_modules/.bin/protoc-gen-ts_proto --ts_proto_out=./{path-to-save-locally} ./{path-to-my-service-proto} --ts_proto_opt=outputEncodeMethods=false,outputJsonMethods=false,outputClientImpl-false,esModuleInterop=true,snakeToCamel=false,stringEnums=true,esModuleInterop=true
It works well for 99.9% of the cases, except service like below. UnifiedGateway is a service proto.
UnifiedGateway
export interface UnifiedGateway { ValidateBasket( request: ValidateBasketRequest ): Promise<ValidateBasketResponse>; } export class UnifiedGatewayClientImpl implements UnifiedGateway { private readonly rpc: Rpc; constructor(rpc: Rpc) { this.rpc = rpc; } ValidateBasket( request: ValidateBasketRequest ): Promise<ValidateBasketResponse> { const data = ValidateBasketRequest.encode(request).finish(); const promise = this.rpc.request( "com.priceline.usp.services.external.UnifiedGateway", "ValidateBasket", data ); return promise.then((data) => ValidateBasketResponse.decode(new _m0.Reader(data)) ); } }
And I got typescript error around ValidateBasketResponse saying
ValidateBasketResponse
'ValidateBasketRequest' only refers to a type, but is being used as a value here.
Any idea how can I resolve this error?
Thanks a lot.
,outputClientImpl-false,
Looks like you have a - instead of an = in turning off the client output. :-)
-
=
I'm using cmd below to generate the ts interface, basically I'm using the
only types
case.It works well for 99.9% of the cases, except service like below.
UnifiedGateway
is a service proto.And I got typescript error around
ValidateBasketResponse
sayingAny idea how can I resolve this error?
Thanks a lot.