Skip to content
This repository was archived by the owner on Jun 26, 2023. It is now read-only.

fix: pubsub typescript type export #127

Closed
wants to merge 1 commit into from

Conversation

wemeetagain
Copy link
Member

@wemeetagain wemeetagain commented Dec 28, 2021

Resolve #114

I'm not entirely sure what about the typesVersions field breaks the types, but... removing it resolves the problem.
We shouldn't need the typesVersions field anyways unless we have different types for different versions of typescript.

Added an additional field to typeVersions. Based on how it's done in uint8arrays

This probably should be applied to all of the packages, but I tested this locally against gossipsub.
LMK if you'd like me to apply this consistently.

@achingbrain
Copy link
Member

We need the typesVersions field to do deep requires, hence the ci failure:

Error: libp2p-interfaces-compliance-tests: src/pubsub/messages.ts(5,24): error TS2307: Cannot find module 'libp2p-pubsub/utils' or its corresponding type declarations.
Error: libp2p-interfaces-compliance-tests: src/pubsub/messages.ts(6,29): error TS2307: Cannot find module 'libp2p-pubsub/peer-streams' or its corresponding type declarations.

Chances are the types are breaking because typesVersions is missing a wildcard - if you build with --traceResolution you should be able to see where tsc is trying to load the .d.ts from and why it's not doing what we think it should be doing.

@wemeetagain wemeetagain force-pushed the fix/pubsub-impl-types branch from 600b837 to 7115803 Compare January 5, 2022 15:37
@wemeetagain
Copy link
Member Author

Thanks for the --traceResolution advice, very helpful for debugging.

@achingbrain ready for another review

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pubsub: Could not find a declaration file for module 'libp2p-pubsub'
2 participants