Skip to content
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

Fix type definition for v0.35.6 #1078

Merged
merged 1 commit into from
Dec 24, 2021

Conversation

twoeths
Copy link
Contributor

@twoeths twoeths commented Dec 23, 2021

Motivation

  • I'd like to fix tsc compilation error when using v0.35.6 for lodestar

Description
Closes #1073

Signed-off-by: Tuyen Nguyen <vutuyen2636@gmail.com>
@@ -110,7 +112,7 @@ const { updateSelfPeerRecord } = require('./record/utils')
* @property {KeychainOptions & import('./keychain/index').KeychainOptions} [keychain]
* @property {MetricsOptions & import('./metrics').MetricsOptions} [metrics]
* @property {import('./peer-routing').PeerRoutingOptions} [peerRouting]
* @property {PeerStoreOptions & import('./peer-store/persistent').PersistentPeerStoreOptions} [peerStore]
* @property {PeerStoreOptions & PersistentPeerStoreOptions} [peerStore]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why can't we use the types defined in

* @typedef {Object} PersistentPeerStoreOptions
instead of duplicating them?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose that's an issue with pbjs when we use that along with const PersistentPeerStore = require('./peer-store/persistent') at the beginning, it'd generate PersistentPeerStore.PersistentPeerStoreOptions and cause the error

@chainsafe/lodestar: ../../node_modules/libp2p/dist/src/index.d.ts:413:37 - error TS2503: Cannot find namespace 'PersistentPeerStore'.
@chainsafe/lodestar: 413     peerStore?: (PeerStoreOptions & PersistentPeerStore.PersistentPeerStoreOptions) | undefined;

this does not look fancy but I can't find other ways to get through that, any suggestions @vasco-santos ? Upgrading to the latest version of pbjs did not help

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, let's keep it. It is just a property

@vasco-santos vasco-santos merged commit cb0d7d6 into libp2p:master Dec 24, 2021
@twoeths twoeths deleted the tuyen/fix-0.35.6-types branch December 26, 2021 01:45
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.

Typescript build error
2 participants