diff --git a/.gitignore b/.gitignore index a06aeca..1c67014 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,10 @@ node_modules +build dist .docs .coverage +node_modules package-lock.json yarn.lock - go-libp2p-webtransport-server/main +.vscode diff --git a/package.json b/package.json index 96d8c3b..54cb4af 100644 --- a/package.json +++ b/package.json @@ -167,7 +167,7 @@ "uint8arraylist": "^2.3.3" }, "devDependencies": { - "aegir": "^37.5.6", + "aegir": "^38.1.7", "libp2p": "^0.42.0" }, "browser": { diff --git a/src/index.ts b/src/index.ts index fbe0def..60342a5 100644 --- a/src/index.ts +++ b/src/index.ts @@ -50,7 +50,7 @@ async function webtransportBiDiStreamToStream (bidiStream: any, streamId: string const reader = bidiStream.readable.getReader() await writer.ready - function cleanupStreamFromActiveStreams () { + function cleanupStreamFromActiveStreams (): void { const index = activeStreams.findIndex(s => s === stream) if (index !== -1) { activeStreams.splice(index, 1) @@ -138,7 +138,7 @@ async function webtransportBiDiStreamToStream (bidiStream: any, streamId: string stream.close() }, stat: { - direction: direction, + direction, timeline: { open: Date.now() } }, metadata: {}, @@ -276,7 +276,7 @@ class WebTransport implements Transport { } } - get [Symbol.toStringTag] () { + get [Symbol.toStringTag] (): '@libp2p/webtransport' { return '@libp2p/webtransport' } @@ -476,7 +476,7 @@ class WebTransport implements Transport { /** * Takes a list of `Multiaddr`s and returns only valid webtransport addresses. */ - filter (multiaddrs: Multiaddr[]) { + filter (multiaddrs: Multiaddr[]): Multiaddr[] { return multiaddrs.filter(ma => ma.protoNames().includes('webtransport')) } } diff --git a/test/browser.ts b/test/browser.ts index c33ba3e..5bbca13 100644 --- a/test/browser.ts +++ b/test/browser.ts @@ -60,7 +60,7 @@ describe('libp2p-webtransport', () => { res = Date.now() - now })()) - await stream.close() + stream.close() expect(res).to.be.greaterThan(-1) } @@ -99,7 +99,7 @@ describe('libp2p-webtransport', () => { connectionEncryption: [noise()] }) - async function * gen () { + async function * gen (): AsyncGenerator { yield new Uint8Array([0]) yield new Uint8Array([1, 2, 3, 4]) yield new Uint8Array([5, 6, 7])