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

Commit e0641fc

Browse files
authored
fix: specify stream sink return type (#378)
To let tsc handle return types properly and avoid the `unknown` type.
1 parent 56fe306 commit e0641fc

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

packages/interface-connection/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export interface StreamStat {
7272
* It may be encrypted and multiplexed depending on the
7373
* configuration of the nodes.
7474
*/
75-
export interface Stream extends Duplex<AsyncGenerator<Uint8ArrayList>, Source<Uint8ArrayList | Uint8Array>> {
75+
export interface Stream extends Duplex<AsyncGenerator<Uint8ArrayList>, Source<Uint8ArrayList | Uint8Array>, Promise<void>> {
7676
/**
7777
* Closes the stream for **reading** *and* **writing**.
7878
*

packages/interface-mocks/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@
153153
"@libp2p/interface-transport": "^3.0.0",
154154
"@libp2p/interfaces": "^3.0.0",
155155
"@libp2p/logger": "^2.0.0",
156-
"@libp2p/multistream-select": "^3.1.6",
156+
"@libp2p/multistream-select": "^3.1.7",
157157
"@libp2p/peer-collections": "^3.0.1",
158158
"@libp2p/peer-id": "^2.0.0",
159159
"@libp2p/peer-id-factory": "^2.0.0",

packages/interface-mocks/src/connection.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ export function mockConnection (maConn: MultiaddrConnection, opts: MockConnectio
170170
return connection
171171
}
172172

173-
export function mockStream (stream: Duplex<AsyncGenerator<Uint8ArrayList>, Source<Uint8ArrayList | Uint8Array>>): Stream {
173+
export function mockStream (stream: Duplex<AsyncGenerator<Uint8ArrayList>, Source<Uint8ArrayList | Uint8Array>, Promise<void>>): Stream {
174174
return {
175175
...stream,
176176
close: () => {},

0 commit comments

Comments
 (0)