Skip to content

Conversation

teogeb
Copy link
Contributor

@teogeb teogeb commented Jun 25, 2025

Async dispose

Upgrade caused multiple errors about missing [Symbol.asyncDispose]() in npm run check:

  ../../node_modules/typescript/lib/lib.esnext.disposable.d.ts:40:5
    [Symbol.asyncDispose](): PromiseLike<void>;
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    '[Symbol.asyncDispose]' is declared here.

test/unit/PushPipeline.test.ts:108:15 - error TS2345: Argument of type 'PushPipeline<StreamMessage, StreamMessage>' is not assignable to parameter of type 'IPushBuffer<Error | StreamMessage, Error | StreamMessage>'.
  Property '[Symbol.asyncDispose]' is missing in type 'PushPipeline<StreamMessage, StreamMessage>' but required in type 'AsyncGenerator<Error | StreamMessage, any, any>'.

Not sure how esnext types are used (the sdk uses es2021 in tsconfig.jest.json).

Added simple implementations of [Symbol.asyncDispose]() to PushBuffer and PipeLine. That solved the issue.

Bucket test

Changed Bucket to throw TypeError instead of generic Error. Now functionality matches what we assert in the Bucket.test.ts.

Future improvements

Add tests for the [Symbol.asyncDispose]() implementations (i.e. the correct cleanup actually happens)

@github-actions github-actions bot added network Related to Network Package test-utils Related to Test Utils Package dht Related to DHT package sdk labels Jun 25, 2025
@github-actions github-actions bot added the node label Jun 26, 2025
@github-actions github-actions bot added the Stale label Aug 26, 2025
@github-actions github-actions bot closed this Sep 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dht Related to DHT package network Related to Network Package node sdk Stale test-utils Related to Test Utils Package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant