-
Notifications
You must be signed in to change notification settings - Fork 5
Conversation
e2101be
to
c92a92c
Compare
src/stream-to-ma-conn.js
Outdated
async sink (source) { | ||
if (options.signal) { | ||
// @ts-ignore abortable has no type definitions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I retried it deconstructing the require and it has types indeed. However, types infer that the Uint8Array will be a source with numbers for reasons 🤷🏼 I updated the ignore message to not block on this
src/ip-port-to-multiaddr.js
Outdated
@@ -21,25 +21,28 @@ function ipPortToMultiaddr (ip, port) { | |||
throw errCode(new Error(`invalid ip provided: ${ip}`), errors.ERR_INVALID_IP_PARAMETER) | |||
} | |||
|
|||
// @ts-ignore parseInt expects only string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better to just wrap with an if clause
f21db73
to
6484b98
Compare
Co-authored-by: Hugo Dias <[email protected]>
6484b98
to
f510e8f
Compare
src/ip-port-to-multiaddr.js
Outdated
return multiaddr(`/ip4/${ip}/tcp/${port}`) | ||
} | ||
} catch (_) {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you're ignoring the error you can use optional catch binding here:
} catch (_) {} | |
} catch {} |
return ip6.is4() | ||
? multiaddr(`/ip4/${ip6.to4().correctForm()}/tcp/${port}`) | ||
: multiaddr(`/ip6/${ip}/tcp/${port}`) | ||
} catch (err) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this error get logged somewhere?
src/stream-to-ma-conn.js
Outdated
@@ -35,23 +51,24 @@ function streamToMaConnection ({ stream, remoteAddr, localAddr }, options = {}) | |||
} | |||
close() | |||
}, | |||
|
|||
// @ts-ignore abortable has no type definitions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An index.d.ts
was added two years ago? alanshaw/abortable-iterator@c3c68a1#diff-7aa4473ede4abd9ec099e87fec67fd57afafaf39e05d493ab4533acc38547eb8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand why, I will open an issue in abortable-iterator
. It is not exporting correctly the types in the default for some reason. I get abortable is not callable
However, if we do const { source: abortable } = require('abortable-iterator')
it will infer the types correctly
d678b68
to
7371423
Compare
7ad842c
to
64a90ee
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems fine to me
This PR adds types to
libp2p-utils
and changes its CI to github actions