Skip to content

chore: Migrate to using factory methods #523

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

tysonclugg
Copy link

@tysonclugg tysonclugg commented Apr 16, 2025

Required since things like libp2p/js-libp2p#2717 landed which no longer exports FloodSub from @libp2p/floodsub.

Required since libp2p/js-libp2p#2717 landed which
no longer exports `FloodSub` from `@libp2p/floodsub`.
@tysonclugg tysonclugg requested a review from a team as a code owner April 16, 2025 04:22
Use the `gossipsub` factory to resolve this error:
```
npm run test

> @chainsafe/libp2p-gossipsub@14.1.1 pretest
> npm run build

> @chainsafe/libp2p-gossipsub@14.1.1 build
> aegir build

[14:34:08] tsc [started]
test/utils/create-pubsub.ts:53:22 - error TS2351: This expression is not constructable.
  Not all constituents of type '((init?: FloodSubInit | undefined) => (components: FloodSubComponents) => PubSub<PubSubEvents>) | typeof GossipSub' are constructable.
    Type '(init?: FloodSubInit | undefined) => (components: FloodSubComponents) => PubSub<PubSubEvents>' has no construct signatures.

53   const pubsub = new Ctor(components, opts.init) as GossipSub
                        ~~~~

Found 1 error in test/utils/create-pubsub.ts:53
```
Resolves errors like below from running `pnpm install`:
```
test/utils/create-pubsub.ts:7:10 - error TS2724: '"@libp2p/peer-store"' has no exported member named 'PersistentPeerStore'. Did you mean 'persistentPeerStore'?

7 import { PersistentPeerStore } from '@libp2p/peer-store'
           ~~~~~~~~~~~~~~~~~~~

  node_modules/.pnpm/@libp2p+peer-store@11.1.3/node_modules/@libp2p/peer-store/dist/src/index.d.ts:46:25
    46 export declare function persistentPeerStore(components: PersistentPeerStoreComponents, init?: PersistentPeerStoreInit): PeerStore;
                               ~~~~~~~~~~~~~~~~~~~
    'persistentPeerStore' is declared here.
```
@tysonclugg tysonclugg changed the title chore: Use floodsub factory method chore: Migrate to using factory methods Apr 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant