diff --git a/src/circuit/transport.js b/src/circuit/transport.js index eaf031d8..fc2ddad4 100644 --- a/src/circuit/transport.js +++ b/src/circuit/transport.js @@ -24,6 +24,7 @@ const transportSymbol = Symbol.for('@libp2p/js-libp2p-circuit/circuit') * @typedef {import('multiaddr')} Multiaddr * @typedef {import('libp2p-interfaces/src/connection').Connection} Connection * @typedef {import('libp2p-interfaces/src/stream-muxer/types').MuxedStream} MuxedStream + * @typedef {import('../types').CircuitRequest} CircuitRequest */ class Circuit { @@ -53,6 +54,7 @@ class Circuit { * @param {MuxedStream} props.stream */ async _onProtocol ({ connection, stream }) { + /** @type {import('./circuit/stream-handler')} */ const streamHandler = new StreamHandler({ stream }) const request = await streamHandler.read() diff --git a/src/index.js b/src/index.js index 7e620403..c22b022d 100644 --- a/src/index.js +++ b/src/index.js @@ -394,7 +394,7 @@ class Libp2p extends EventEmitter { * * @async * @param {PeerId|Multiaddr|string} peer - The peer to dial - * @param {null|string[]|string} protocols + * @param {string[]|string} protocols * @param {object} [options] * @param {AbortSignal} [options.signal] * @returns {Promise} diff --git a/src/record/peer-record/index.js b/src/record/peer-record/index.js index 4ded73c4..a0421f6e 100644 --- a/src/record/peer-record/index.js +++ b/src/record/peer-record/index.js @@ -65,10 +65,14 @@ class PeerRecord { /** * Returns true if `this` record equals the `other`. * - * @param {PeerRecord} other - * @returns {other is Record} + * @param {unknown} other + * @returns {boolean} */ equals (other) { + if (!(other instanceof PeerRecord)) { + return false + } + // Validate PeerId if (!this.peerId.equals(other.peerId)) { return false