Skip to content

Commit

Permalink
Fix type resolvability for non-grpc implementation of unwrapped rpc args
Browse files Browse the repository at this point in the history
  • Loading branch information
programmador committed Dec 21, 2023
1 parent a48061a commit bf73457
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion integration/wrappers-regression/wrappers-regression.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class ClockClientImpl implements Clock {
}

NowString(request: string | undefined): Promise<StringValue> {
const data = StringValue.encode({ value: request }).finish();
const data = StringValue.encode(StringValue.fromPartial({ value: request })).finish();
const promise = this.rpc.request(this.service, "NowString", data);
return promise.then((data) => StringValue.decode(_m0.Reader.create(data)));
}
Expand Down
5 changes: 3 additions & 2 deletions src/generate-services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,9 @@ function generateRegularRpcMethod(ctx: Context, methodDesc: MethodDescriptorProt
`;
}

const inputValue = isValueType && !methodDesc.clientStreaming ? '{ value: request }' : 'request';
let encode = code`${rawInputType}.encode(${inputValue}).finish()`;
let encode = isValueType && !methodDesc.clientStreaming
? code`${rawInputType}.encode(${rawInputType}.fromPartial({ value: request })).finish()`
: code`${rawInputType}.encode(request).finish()`;
let beforeRequest;
if (options.rpcBeforeRequest) {
beforeRequest = code`
Expand Down

0 comments on commit bf73457

Please sign in to comment.