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

How to use the metadata type in a custom type? #5780

Open
3 of 10 tasks
0xverin opened this issue Jan 15, 2024 · 0 comments
Open
3 of 10 tasks

How to use the metadata type in a custom type? #5780

0xverin opened this issue Jan 15, 2024 · 0 comments
Labels
Support Tracks issues or requests related to troubleshooting, answering questions, and user assistance.

Comments

@0xverin
Copy link

0xverin commented Jan 15, 2024

  • I'm submitting a ...
  • Bug report
  • Feature request
  • Support request
  • Other
  • What is the current behavior and expected behavior?
export default {
    types: {
        VCRequested: {
            xxx: "xxx",
            assertion: "Assertion",
        },
        Assertion: {
            xxxx: "xxx"
        }
    }
}

As shown in the above code, Assertion is my custom type, but there is a CorePrimitiveAssertion type within metadata that is identical to Assertion. I want to directly replace it with CorePrimitiveAssertion, but when generating types, I get an error:

build/interfaces/vc/types.ts:266:25 - error TS2304: Cannot find name 'CorePrimitiveAssertion'.

266     readonly assertion: CorePrimitiveAssertion;
                            ~~~~~~~~~~~~~~~~~~~~~~

It seems that CorePrimitiveAssertion is not automatically imported into the generated types.If I manually import the following code in this file, it all works:

import type { CorePrimitivesAssertion } from '@polkadot/types/lookup';

All other types work fine. I just want to replace an existing type in metadata within a custom type. Is this achievable?

  • Please tell us about your environment:
  • Version:

"@polkadot/api": "^10.9.1"

  • Environment:

    • Node.js
    • Browser
    • Other (limited support for other environments)
  • Language:

    • JavaScript
    • TypeScript (include tsc --version)
    • Other
@TarikGul TarikGul added the Support Tracks issues or requests related to troubleshooting, answering questions, and user assistance. label Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Support Tracks issues or requests related to troubleshooting, answering questions, and user assistance.
Projects
Development

No branches or pull requests

2 participants