Skip to content

Commit

Permalink
fix(stream): remove a duplicate call
Browse files Browse the repository at this point in the history
  • Loading branch information
yume-chan committed Dec 22, 2023
1 parent 19bb1c4 commit 4494e1b
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions libraries/stream-extra/src/consumable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ export class Consumable<T> {
this.#resolver.resolve();
}

error(error: any) {
error(error: unknown) {
this.#resolver.reject(error);
}

async tryConsume<U>(callback: (value: T) => U) {
try {
// eslint-disable-next-line @typescript-eslint/await-thenable
const result = await this.#task.run(() => callback(this.value));
this.consume();
this.#resolver.resolve();
return result;
} catch (e) {
this.#resolver.reject(e);
Expand Down Expand Up @@ -212,7 +212,6 @@ export class ConsumableWritableStream<T> extends WritableStream<Consumable<T>> {
await chunk.tryConsume(
(value) => sink.write?.(value, controller),
);
chunk.consume();
},
abort(reason) {
return sink.abort?.(reason);
Expand Down

0 comments on commit 4494e1b

Please sign in to comment.