repeated bytes does not have the corresponding "_asB64" method in its .d.ts file
- Dominant language
- JavaScript
- Stars
- 9.3k
- Forks
- 802
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 5
Description
I am making something with grpc-web and found `repeated bytes` having a missing method in its generated `.d.ts` file. I have made a simplified `.proto` file for testing:
```proto
service Service {
rpc SampleAPI (SampleRequest) returns (SampleResponse);
}
message SampleRequest {
bytes foo = 1;
repeated bytes bar = 2;
}
message SampleResponse {
bytes foo = 1;
repeated bytes bar = 2;
}
```
Generating the typescript & javascript files from the command suggested by the doc, i.e,:
```bash
protoc -I=$DIR echo.proto \
--js_out=import_style=commonjs,binary:$OUT_DIR \
--grpc-web_out=import_style=typescript,mode=grpcwebtext:$OUT_DIR
```
Although there is a `getBarList_asB64` in the generated `pb.js` file, the method prototype is not available in `pb.d.js`.
```javascript
// *_pb.js
/**
* repeated bytes bar = 2;
* This is a type-conversion wrapper around `getBarList()`
* @return {!Array}
*/
proto.enfs.v1.SampleRequest.prototype.getBarList_asB64 = function() {
return /** @type {!Array} */ (jspb.Message.bytesListAsB64(
this.getBarList()));
};
```
```typescript
// *_pb.d.ts
export class SampleRequest extends jspb.Message {
getFoo(): Uint8Array | string;
getFoo_asU8(): Uint8Array;
getFoo_asB64(): string;
setFoo(value: Uint8Array | string): SampleRequest;
getBarList(): Array;
setBarList(value: Array): SampleRequest;
clearBarList(): SampleRequest;
addBar(value: Uint8Array | string, index?: number): SampleRequest;
// omitted
}
```
Here is the versions for protoc & grpc web:
- protoc: 3.14.0
- grpc-web: 1.2.1
Many thanks for noticing this!
Contributor guide
Assessment
This issue has not been assessed yet.