Skip to content

typescript: Incompatible @multiformats/multiaddr version between newest versions of gossipsub and libp2p #537

@Jollarvia

Description

@Jollarvia

I get the typescript error:

Type '(components: GossipSubComponents) => PubSub<GossipsubEvents>' is not assignable to type '(components: Components & { pubsub: PubSub<GossipsubEvents>; identify: Identify; }) => PubSub<GossipsubEvents>'. Types of parameters 'components' and 'components' are incompatible. Type 'Components & { pubsub: PubSub<GossipsubEvents>; identify: Identify; }' is not assignable to type 'GossipSubComponents'. The types of 'peerStore.forEach' are incompatible between these types. Type '(fn: (peer: import("c:/Users/Julio/repos/etailer/node_modules/@libp2p/interface/dist/src/peer-store", { with: { "resolution-mode": "import" } }).Peer) => void, query?: import("c:/Users/Julio/repos/etailer/node_modules/@libp2p/interface/dist/src/peer-store", { with: { "resolution-mode": "import" } }).PeerQuery | unde...' is not assignable to type '(fn: (peer: import("c:/Users/Julio/repos/etailer/node_modules/@chainsafe/libp2p-gossipsub/node_modules/@libp2p/interface/dist/src/peer-store", { with: { "resolution-mode": "import" } }).Peer) => void, query?: import("c:/Users/Julio/repos/etailer/node_modules/@chainsafe/libp2p-gossipsub/node_modules/@libp2p/interface...'. Types of parameters 'fn' and 'fn' are incompatible. Types of parameters 'peer' and 'peer' are incompatible. Type 'import("c:/Users/Julio/repos/etailer/node_modules/@libp2p/interface/dist/src/peer-store", { with: { "resolution-mode": "import" } }).Peer' is not assignable to type 'import("c:/Users/Julio/repos/etailer/node_modules/@chainsafe/libp2p-gossipsub/node_modules/@libp2p/interface/dist/src/peer-store", { with: { "resolution-mode": "import" } }).Peer'. Types of property 'addresses' are incompatible. Type 'import("c:/Users/Julio/repos/etailer/node_modules/@libp2p/interface/dist/src/peer-store", { with: { "resolution-mode": "import" } }).Address[]' is not assignable to type 'import("c:/Users/Julio/repos/etailer/node_modules/@chainsafe/libp2p-gossipsub/node_modules/@libp2p/interface/dist/src/peer-store", { with: { "resolution-mode": "import" } }).Address[]'. Type 'import("c:/Users/Julio/repos/etailer/node_modules/@libp2p/interface/dist/src/peer-store", { with: { "resolution-mode": "import" } }).Address' is not assignable to type 'import("c:/Users/Julio/repos/etailer/node_modules/@chainsafe/libp2p-gossipsub/node_modules/@libp2p/interface/dist/src/peer-store", { with: { "resolution-mode": "import" } }).Address'. Types of property 'multiaddr' are incompatible. Type 'Multiaddr' is missing the following properties from type 'Multiaddr': toOptions, protos, protoCodes, protoNames, and 7 more.

when trying to create libp2p with gossipsub. My dependencies are

 "dependencies": {
    "@chainsafe/libp2p-gossipsub": "^14.1.2",
    "helia": "^6.0.11"
  }

I also notice multiaddr is on different major version - 12 in gossipsub and 13 in Libp2p https://github.com/libp2p/js-libp2p/blob/main/packages/gossipsub/package.json

Maybe this is the cause?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions