-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add types #189
feat: add types #189
Conversation
This PR also updates aegir and others deps.
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.
Almost done, left a few comments for final details and we need to decide if we want to do a breaking change or not here, in the toOptions
return type
Also, probably worth flag that we should add to the release notes a notice for deprecation of the factory to already give a heads up to users
README.md
Outdated
@@ -85,7 +65,7 @@ the global namespace. | |||
```js | |||
$ node | |||
|
|||
> const multiaddr = require('multiaddr') | |||
> const { multiaddr } = require('multiaddr') | |||
|
|||
> const addr = multiaddr("/ip4/127.0.0.1/udp/1234") |
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.
> const addr = multiaddr("/ip4/127.0.0.1/udp/1234") | |
> const addr = new Multiaddr("/ip4/127.0.0.1/udp/1234") |
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 a factory method exported
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.
yes, but all the other code examples in jsdocs are with the constructor, why having these different? I also thought we were going to migrate into using the class instance in the future
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.
the factory method returns an instance, its just an helper i will add an example of both
README.md
Outdated
@@ -85,7 +65,7 @@ the global namespace. | |||
```js | |||
$ node | |||
|
|||
> const multiaddr = require('multiaddr') | |||
> const { multiaddr } = require('multiaddr') |
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.
> const { multiaddr } = require('multiaddr') | |
> const { Multiaddr } = require('multiaddr') |
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.
theres a factory method exported
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.
yes, but all the other code examples in jsdocs are with the constructor, why having these different? I also thought we were going to migrate into using the class instance in the future
/** @type {MultiaddrObject} */ | ||
const opts = {} | ||
const parsed = this.toString().split('/') | ||
opts.family = parsed[1] === 'ip4' ? 4 : 6 |
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.
This will mean a breaking change
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.
can you add a breaking change message to the commit?
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 am thinking if we really want to make a breaking change just for this change and removing the resolve static function. This will mean we need to update all the modules. What do you think?
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.
its a breaking change already because the exports changed right ?
@hugomrdias can you look into the CI? |
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.
sgtm, for what that's worth
update the readme usage example with the factory function, remove the |
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.
LGTM
The webworker tests have an issue though
We have an issue on firefox worker still. Can you check it? |
Is there any chance the Firefox problem was related to the one @achingbrain had with js-ipfs which forced him to disable it? I think it was with webworkers running twice there but the output doesn't seem to suggest the same here (although there isn't much useful output, just a timeout). |
No, i already fixed this just need to release pw-test. Double output should still happen though. |
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.
LGTM
This PR adds types, updates aegir and others deps.
BREAKING CHANGES:
toOptions
output changed to match nodefromNodeAddress
andnodeAddress
inputs/outputs now matchcloses #160
closes #159