fix return type of getHubs()

This commit is contained in:
Andre Staltz 2024-01-16 13:02:31 +02:00
parent c8f8e11c0b
commit 9446faa823
No known key found for this signature in database
GPG Key ID: 9EDE23EA7E8A4890
1 changed files with 4 additions and 2 deletions

View File

@ -71,7 +71,7 @@ function initHubClient(peer, config) {
/**
* @param {number} amount
* @param {CB<Array<string>>} cb
* @param {CB<Array<`/${string}`>>} cb
*/
getHubs(amount, cb) {
const source = peer.net.peers()
@ -81,7 +81,9 @@ function initHubClient(peer, config) {
if (err) return cb(new Error('Failed to get hubs', { cause: err }))
// @ts-ignore
const infoMap = /**@type {Map<`/${string}`, Info>}*/ (new Map(peers))
const multiaddrs = peer.set.values(HUBS_SUBDOMAIN)
const multiaddrs = /**@type {Array<`/${string}`>}*/ (
peer.set.values(HUBS_SUBDOMAIN)
)
const hubs = []
for (const multiaddr of multiaddrs) {
const stats = infoMap.get(multiaddr)?.stats ?? { failure: 1 }