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

conflicting and duplicate types when generating types for multiple networks, in the same project #5773

Closed
3 of 10 tasks
Muhammad-Altabba opened this issue Dec 18, 2023 · 2 comments
Labels
Support Tracks issues or requests related to troubleshooting, answering questions, and user assistance.

Comments

@Muhammad-Altabba
Copy link

Generating types for multiple networks in the same project results in errors because of some conflicting types and some other duplicate types. You can check the manual fixing done at: https://github.com/conx3/hackathon-2023-winter/commit/ddb35ec68ffb73445bd8c268eef16573787ca808

Or, is there a possible configuration to not have conflicts? I could not find something related to this in the docs.

Thanks,

  • I'm submitting a ...
  • Bug report
  • Feature request
  • Support request
  • Other
@jacogr
Copy link
Member

jacogr commented Dec 19, 2023

It is certainly intended - the typegen is not a free for all - if networks have different types, it would certainly conflict.

The api itself generates types for Substrate, Kusama & Polkadot, see https://github.com/polkadot-js/api/tree/master/packages/api-augment/src. They are completely split (so it is possible to generate seperate types), but it is certainly not intended that you can include all three at any point in time. Types are static and cannot be magically injected into TS based on a per-network basis, like metadata.

Because of the static nature of types -

  1. You can generate types for all networks you desire
  2. You can only include one network per codebase to allow TS to type-check

If you try and add multiples to the same codebase, you will be in a world of hurt since they will overlap.

@jacogr jacogr closed this as completed Dec 19, 2023
@jacogr jacogr added the Support Tracks issues or requests related to troubleshooting, answering questions, and user assistance. label Dec 19, 2023
@polkadot-js-bot
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue if you think you have a related problem or query.

@polkadot-js polkadot-js locked as resolved and limited conversation to collaborators Dec 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Support Tracks issues or requests related to troubleshooting, answering questions, and user assistance.
Projects
None yet
Development

No branches or pull requests

3 participants