mirror of
https://github.com/grpc/grpc-node.git
synced 2025-12-08 18:23:54 +00:00
Fix stream.write type incompatibility
This commit is contained in:
parent
1af773ca54
commit
446d560fde
@ -7,7 +7,7 @@ import {EmitterAugmentation1} from './events';
|
||||
import {Filter} from './filter';
|
||||
import {FilterStackFactory} from './filter-stack';
|
||||
import {Metadata} from './metadata';
|
||||
import {ObjectDuplex} from './object-stream';
|
||||
import {ObjectDuplex, WriteCallback} from './object-stream';
|
||||
|
||||
const {HTTP2_HEADER_STATUS, HTTP2_HEADER_CONTENT_TYPE, NGHTTP2_CANCEL} =
|
||||
http2.constants;
|
||||
@ -71,7 +71,7 @@ export class Http2CallStream extends Duplex implements CallStream {
|
||||
private http2Stream: http2.ClientHttp2Stream|null = null;
|
||||
private pendingRead = false;
|
||||
private pendingWrite: Buffer|null = null;
|
||||
private pendingWriteCallback: Function|null = null;
|
||||
private pendingWriteCallback: WriteCallback | null = null;
|
||||
private pendingFinalCallback: Function|null = null;
|
||||
|
||||
private readState: ReadState = ReadState.NO_DATA;
|
||||
@ -441,7 +441,7 @@ export class Http2CallStream extends Duplex implements CallStream {
|
||||
}
|
||||
}
|
||||
|
||||
_write(chunk: WriteObject, encoding: string, cb: Function) {
|
||||
_write(chunk: WriteObject, encoding: string, cb: WriteCallback) {
|
||||
this.filterStack.sendMessage(Promise.resolve(chunk)).then((message) => {
|
||||
if (this.http2Stream === null) {
|
||||
this.pendingWrite = message.message;
|
||||
|
||||
@ -3,6 +3,8 @@ import {EmitterAugmentation1} from './events';
|
||||
|
||||
// tslint:disable:no-any
|
||||
|
||||
export type WriteCallback = (error: Error | null | undefined) => void;
|
||||
|
||||
export interface IntermediateObjectReadable<T> extends Readable {
|
||||
read(size?: number): any&T;
|
||||
}
|
||||
@ -13,8 +15,8 @@ export type ObjectReadable<T> = {
|
||||
|
||||
export interface IntermediateObjectWritable<T> extends Writable {
|
||||
_write(chunk: any&T, encoding: string, callback: Function): void;
|
||||
write(chunk: any&T, cb?: Function): boolean;
|
||||
write(chunk: any&T, encoding?: any, cb?: Function): boolean;
|
||||
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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user