Merge pull request #2011 from murgatroid99/grpc-js_types_node_fix_1.3

grpc-js: Fix compatibility with @types/node 17.0.6 (1.3.x)
This commit is contained in:
Michael Lumish 2022-01-06 12:38:15 -08:00 committed by GitHub
commit 0dfed7677f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 22 deletions

View File

@ -36,9 +36,9 @@ 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> {
@ -46,20 +46,7 @@ export interface ObjectWritable<T> extends IntermediateObjectWritable<T> {
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>;

View File

@ -235,7 +235,7 @@ export class ServerWritableStreamImpl<RequestType, ResponseType>
this.trailingMetadata = metadata;
}
super.end();
return super.end();
}
}
@ -280,7 +280,7 @@ export class ServerDuplexStreamImpl<RequestType, ResponseType> extends Duplex
this.trailingMetadata = metadata;
}
super.end();
return super.end();
}
}
@ -290,7 +290,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> = (