Skip to content

Commit

Permalink
Merge pull request #2007 from murgatroid99/grpc-js_types_node_fix
Browse files Browse the repository at this point in the history
grpc-js: Fix compatibility with @types/node 17.0.6
  • Loading branch information
murgatroid99 committed Jan 4, 2022
2 parents 5548679 + fba2b94 commit a65fdce
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 23 deletions.
2 changes: 1 addition & 1 deletion packages/grpc-js/package.json
@@ -1,6 +1,6 @@
{
"name": "@grpc/grpc-js",
"version": "1.4.5",
"version": "1.4.6",
"description": "gRPC Library for Node - pure JS implementation",
"homepage": "https://grpc.io/",
"repository": "https://github.com/grpc/grpc-node/tree/master/packages/grpc-js",
Expand Down
25 changes: 6 additions & 19 deletions packages/grpc-js/src/object-stream.ts
Expand Up @@ -36,30 +36,17 @@ export interface IntermediateObjectWritable<T> extends Writable {
write(chunk: any & T, cb?: WriteCallback): boolean;
write(chunk: any & T, encoding?: any, cb?: WriteCallback): boolean;
setDefaultEncoding(encoding: string): this;
end(): void;
end(chunk: any & T, cb?: Function): void;
end(chunk: any & T, encoding?: any, cb?: Function): void;
end(): ReturnType<Writable['end']> extends Writable ? this : void;
end(chunk: any & T, cb?: Function): ReturnType<Writable['end']> extends Writable ? this : void;
end(chunk: any & T, encoding?: any, cb?: Function): ReturnType<Writable['end']> extends Writable ? this : void;
}

export interface ObjectWritable<T> extends IntermediateObjectWritable<T> {
_write(chunk: T, encoding: string, callback: Function): void;
write(chunk: T, cb?: Function): boolean;
write(chunk: T, encoding?: any, cb?: Function): boolean;
setDefaultEncoding(encoding: string): this;
end(): void;
end(chunk: T, cb?: Function): void;
end(chunk: T, encoding?: any, cb?: Function): void;
end(): ReturnType<Writable['end']> extends Writable ? this : void;
end(chunk: T, cb?: Function): ReturnType<Writable['end']> extends Writable ? this : void;
end(chunk: T, encoding?: any, cb?: Function): ReturnType<Writable['end']> extends Writable ? this : void;
}

export type ObjectDuplex<T, U> = {
read(size?: number): U;

_write(chunk: T, encoding: string, callback: Function): void;
write(chunk: T, cb?: Function): boolean;
write(chunk: T, encoding?: any, cb?: Function): boolean;
end(): void;
end(chunk: T, cb?: Function): void;
end(chunk: T, encoding?: any, cb?: Function): void;
} & Duplex &
ObjectWritable<T> &
ObjectReadable<U>;
5 changes: 2 additions & 3 deletions packages/grpc-js/src/server-call.ts
Expand Up @@ -236,7 +236,7 @@ export class ServerWritableStreamImpl<RequestType, ResponseType>
this.trailingMetadata = metadata;
}

super.end();
return super.end();
}
}

Expand Down Expand Up @@ -282,7 +282,7 @@ export class ServerDuplexStreamImpl<RequestType, ResponseType>
this.trailingMetadata = metadata;
}

super.end();
return super.end();
}
}

Expand All @@ -292,7 +292,6 @@ ServerDuplexStreamImpl.prototype._write =
ServerWritableStreamImpl.prototype._write;
ServerDuplexStreamImpl.prototype._final =
ServerWritableStreamImpl.prototype._final;
ServerDuplexStreamImpl.prototype.end = ServerWritableStreamImpl.prototype.end;

// Unary response callback signature.
export type sendUnaryData<ResponseType> = (
Expand Down

0 comments on commit a65fdce

Please sign in to comment.