Skip to content

Commit a5bbdf5

Browse files
committed
api lib - rm anys
1 parent e7bfc91 commit a5bbdf5

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

api.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -682,11 +682,11 @@ export async function req<Q = unknown, S = unknown>(
682682
return json;
683683
}
684684

685-
function nodeReadStream(stream: any) {
685+
function nodeReadStream<T = unknown>(stream: any) {
686686
const events = new EventEmitter0();
687-
const batches = [];
687+
const batches: T[][] = [];
688688

689-
let batch = [];
689+
let batch: T[] = [];
690690
let totalBytes = 0;
691691

692692
const batchInterval = setInterval(() => {
@@ -741,7 +741,7 @@ function nodeReadStream(stream: any) {
741741
}
742742
});
743743

744-
stream.on("error", (err) => {
744+
stream.on("error", (err: any) => {
745745
events.emit("end", err);
746746
clearInterval(batchInterval);
747747
});
@@ -761,7 +761,7 @@ function nodeReadStream(stream: any) {
761761
if (batch.length) {
762762
batches.push(batch);
763763
}
764-
resolve([].concat(...batches));
764+
resolve([].concat(...(batches as any)));
765765
});
766766
}),
767767
};
@@ -775,7 +775,7 @@ export async function reqReader<Q = unknown, S = unknown>(
775775
if (typeof _fetch !== "function") {
776776
/* try with node streams */
777777
const resp = await nodeReq(opts, { returnStream: true });
778-
return nodeReadStream(resp) as StreamReader<S>;
778+
return nodeReadStream<S>(resp) as StreamReader<S>;
779779
}
780780

781781
const resp = await _fetch(opts.url, {

0 commit comments

Comments
 (0)