Skip to content
This repository has been archived by the owner on Jun 26, 2023. It is now read-only.

Commit

Permalink
fix: specify stream sink return type (#378)
Browse files Browse the repository at this point in the history
To let tsc handle return types properly and avoid the `unknown` type.
  • Loading branch information
achingbrain authored Apr 18, 2023
1 parent 56fe306 commit e0641fc
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/interface-connection/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export interface StreamStat {
* It may be encrypted and multiplexed depending on the
* configuration of the nodes.
*/
export interface Stream extends Duplex<AsyncGenerator<Uint8ArrayList>, Source<Uint8ArrayList | Uint8Array>> {
export interface Stream extends Duplex<AsyncGenerator<Uint8ArrayList>, Source<Uint8ArrayList | Uint8Array>, Promise<void>> {
/**
* Closes the stream for **reading** *and* **writing**.
*
Expand Down
2 changes: 1 addition & 1 deletion packages/interface-mocks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@
"@libp2p/interface-transport": "^3.0.0",
"@libp2p/interfaces": "^3.0.0",
"@libp2p/logger": "^2.0.0",
"@libp2p/multistream-select": "^3.1.6",
"@libp2p/multistream-select": "^3.1.7",
"@libp2p/peer-collections": "^3.0.1",
"@libp2p/peer-id": "^2.0.0",
"@libp2p/peer-id-factory": "^2.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/interface-mocks/src/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ export function mockConnection (maConn: MultiaddrConnection, opts: MockConnectio
return connection
}

export function mockStream (stream: Duplex<AsyncGenerator<Uint8ArrayList>, Source<Uint8ArrayList | Uint8Array>>): Stream {
export function mockStream (stream: Duplex<AsyncGenerator<Uint8ArrayList>, Source<Uint8ArrayList | Uint8Array>, Promise<void>>): Stream {
return {
...stream,
close: () => {},
Expand Down

0 comments on commit e0641fc

Please sign in to comment.