mirror of https://github.com/grpc/grpc-web.git
Fix some type annotations
This commit is contained in:
parent
71be2dc948
commit
0a4b48e2d0
|
@ -70,26 +70,15 @@ AbstractClientBase.MethodInfo = function(
|
|||
/**
|
||||
* @abstract
|
||||
* @template REQUEST, RESPONSE
|
||||
* Even with ?RESPONSE the RESPONSE will still be inferred as
|
||||
* "FooResponse|Null". Use RESPONSE_LEAN to extract out the "FooResponse"
|
||||
* part. See go/closure-ttl.
|
||||
* @template RESPONSE_LEAN :=
|
||||
* cond(isUnknown(RESPONSE), unknown(),
|
||||
* mapunion(RESPONSE, (X) =>
|
||||
* cond(eq(X, 'undefined'), none(),
|
||||
* cond(eq(X, 'null'), none(),
|
||||
* X))))
|
||||
* =:
|
||||
* @param {string} method The method to invoke
|
||||
* @param {REQUEST} requestMessage The request proto
|
||||
* @param {!Object<string, string>} metadata User defined call metadata
|
||||
* @param {!MethodDescriptor<REQUEST, RESPONSE_LEAN>|
|
||||
* !AbstractClientBase.MethodInfo<REQUEST, RESPONSE_LEAN>}
|
||||
* @param {!MethodDescriptor<REQUEST, RESPONSE>|
|
||||
* !AbstractClientBase.MethodInfo<REQUEST, RESPONSE>}
|
||||
* methodDescriptor Information of this RPC method
|
||||
* @param {function(?Error, ?RESPONSE)}
|
||||
* callback A callback function which takes (error, response)
|
||||
* @return {!ClientReadableStream<RESPONSE_LEAN>|undefined}
|
||||
* The Client Readable Stream
|
||||
* @param {function(?Error, ?)}
|
||||
* callback A callback function which takes (error, RESPONSE or null)
|
||||
* @return {!ClientReadableStream<RESPONSE>|undefined}
|
||||
*/
|
||||
AbstractClientBase.prototype.rpcCall = function(
|
||||
method, requestMessage, metadata, methodDescriptor, callback) {};
|
||||
|
|
|
@ -53,8 +53,9 @@ class StreamBodyClientReadableStream {
|
|||
/**
|
||||
* @param {!GenericTransportInterface} genericTransportInterface The
|
||||
* GenericTransportInterface
|
||||
* @param {function(?): RESPONSE} responseDeserializeFn
|
||||
*/
|
||||
constructor(genericTransportInterface) {
|
||||
constructor(genericTransportInterface, responseDeserializeFn) {
|
||||
/**
|
||||
* @const
|
||||
* @private
|
||||
|
@ -64,9 +65,9 @@ class StreamBodyClientReadableStream {
|
|||
|
||||
/**
|
||||
* @private
|
||||
* @type {function(?): RESPONSE|null} The deserialize function for the proto
|
||||
* @type {function(?): RESPONSE} The deserialize function for the proto
|
||||
*/
|
||||
this.responseDeserializeFn_ = null;
|
||||
this.grpcResponseDeserializeFn_ = responseDeserializeFn;
|
||||
|
||||
/**
|
||||
* @const
|
||||
|
@ -121,7 +122,7 @@ class StreamBodyClientReadableStream {
|
|||
var self = this;
|
||||
this.xhrNodeReadableStream_.on('data', function(data) {
|
||||
if ('1' in data) {
|
||||
var response = self.responseDeserializeFn_(data['1']);
|
||||
var response = self.grpcResponseDeserializeFn_(data['1']);
|
||||
self.sendDataCallbacks_(response);
|
||||
}
|
||||
if ('2' in data) {
|
||||
|
@ -224,7 +225,7 @@ class StreamBodyClientReadableStream {
|
|||
* function for the proto
|
||||
*/
|
||||
setResponseDeserializeFn(responseDeserializeFn) {
|
||||
this.responseDeserializeFn_ = responseDeserializeFn;
|
||||
this.grpcResponseDeserializeFn_ = responseDeserializeFn;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue