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

Typegen adding invalid import #5977

Closed
TarikGul opened this issue Sep 9, 2024 · 2 comments
Closed

Typegen adding invalid import #5977

TarikGul opened this issue Sep 9, 2024 · 2 comments
Labels
Bug Tracks issues causing errors or unintended behavior, critical to fix for reliability. P3 - Low Non-essential improvements or minor fixes. Can be scheduled flexibly as time permits.

Comments

@TarikGul
Copy link
Member

TarikGul commented Sep 9, 2024

rel: #5972

Currently the typegen for 1.3.0 for Kusama is adding StagingXcmV4Xcm to the imports of query.ts when there is no use of the Import. This is causing typescript build issues. I am not able to find the source of the issue as the code is quite complicated. Due to this being a relatively harmless issue, I am adding a build rule to ignore it!

That being said this issue should be fixed, and the bug can be replicated by removing the "noUnusedLocals": false rules in the tsconfig compiler options for the builds.

@TarikGul TarikGul added P3 - Low Non-essential improvements or minor fixes. Can be scheduled flexibly as time permits. Bug Tracks issues causing errors or unintended behavior, critical to fix for reliability. labels Oct 29, 2024
@TarikGul
Copy link
Member Author

We found that the type assignment in the typegen has different lookupName vs type:

ex

 {
  info: 19,
  lookupIndex: 400,
  lookupName: 'StagingXcmV4Xcm',
  type: 'Vec<StagingXcmV4Instruction>',
  docs: [],
  namespace: '',
  sub: {
    docs: [],
    info: 15,
    lookupIndex: 402,
    lookupName: 'StagingXcmV4Instruction',
    type: 'Lookup402'
  },
  lookupNameRoot: undefined,
  typeName: 'Vec<Instruction>'
}

Which is causing different import vs assignment for RecordXcm

@TarikGul
Copy link
Member Author

You can replicate the above output by inserting:

      if (typeDef.lookupName === 'StagingXcmV4Xcm' || typeDef.type === 'StagingXcmV4Xcm') {
        console.log('TYPEDEF: ', lookup.getTypeDef(storageEntry.type.asPlain))
      }

in https://github.com/polkadot-js/api/blob/master/packages/typegen/src/generate/query.ts#L31

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Tracks issues causing errors or unintended behavior, critical to fix for reliability. P3 - Low Non-essential improvements or minor fixes. Can be scheduled flexibly as time permits.
Development

No branches or pull requests

1 participant