Closed dthorpe closed 4 years ago
Thanks for raising this. The correct is only accepting a Buffer, as detailed in libp2p/js-peer-id#new-peeridid-privkey-pubkey.
Would you like to open a PR in peer-id
to fix the typescript declaration file?
It is important pointing out that our work to better support typescript users is still in its beginning. We will move away from the declaration files, and leverage JS docs to achieve them in a cleaner way while also guarantee that they are updated with the code. More Info
@jacobheun can you transfer this issue to the peer-id
repo. I don't have permissions for it
Type: Bug
Severity: Low
Description:
The ts type declaration for the id param of PeerId disagrees with the implementation.
Steps to reproduce the error:
peer-id/src/index.d.ts has this (claims to accept Buffer or string for id):
but the actual implementation does this:
It throws when given a string id param
So, which is it? Remove string from the declaration, or change the class to convert string to buffer?