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

codegen type issue #9500

Closed
twt-- opened this issue Oct 29, 2024 · 0 comments · Fixed by #9581
Closed

codegen type issue #9500

twt-- opened this issue Oct 29, 2024 · 0 comments · Fixed by #9581
Labels
from-community This originated from the community :)

Comments

@twt--
Copy link
Contributor

twt-- commented Oct 29, 2024

aztec codegen (as of at least 0.57.0) is generating code that typescript complains about.

Right now a number of us are working around this with:
sed -i -e 's/as NoirCompiledContract/as unknown as NoirCompiledContract/g' ${CONTRACT}.ts.

Discord discussion: https://discord.com/channels/1144692727120937080/1298434944456069151

src/contracts/Token.ts:38:59 - error TS2352: Conversion of type '{ transpiled: boolean; noir_version: string; name: string; functions: ({ name: string; is_unconstrained: boolean; custom_attributes: string[]; abi: { error_types: { "16137133351287663689"?: undefined; "14336010898202591232"?: undefined; "3469988399892582431"?: undefined; }; parameters: ({ ...; } | { ...; })[]; retur...' to type 'NoirCompiledContract' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
  Types of property 'functions' are incompatible.
    Type '({ name: string; is_unconstrained: boolean; custom_attributes: string[]; abi: { error_types: { "16137133351287663689"?: undefined; "14336010898202591232"?: undefined; "3469988399892582431"?: undefined; }; parameters: ({ ...; } | { ...; })[]; return_type: null; }; bytecode: string; debug_symbols: string; brillig_name...' is not comparable to type 'NoirFunctionEntry[]'.
      Type '{ name: string; is_unconstrained: boolean; custom_attributes: string[]; abi: { error_types: { "16137133351287663689"?: undefined; "14336010898202591232"?: undefined; "3469988399892582431"?: undefined; }; parameters: ({ ...; } | { ...; })[]; return_type: null; }; bytecode: string; debug_symbols: string; brillig_names...' is not comparable to type 'NoirFunctionEntry'.
        Type '{ name: string; is_unconstrained: boolean; custom_attributes: never[]; abi: { error_types: { "3469988399892582431": { error_kind: string; item_types: never[]; length: number; }; "16137133351287663689"?: undefined; "14336010898202591232"?: undefined; }; parameters: ({ ...; } | ... 1 more ... | { ...; })[]; return_typ...' is not comparable to type 'NoirFunctionEntry'.
          The types of 'abi.error_types' are incompatible between these types.
            Type '{ "3469988399892582431": { error_kind: string; item_types: never[]; length: number; }; "16137133351287663689"?: undefined; "14336010898202591232"?: undefined; }' is not comparable to type 'Record<string, AbiErrorType>'.
              Property '"16137133351287663689"' is incompatible with index signature.
                Type 'undefined' is not comparable to type 'AbiErrorType'.

38 export const TokenContractArtifact = loadContractArtifact(TokenContractArtifactJson as NoirCompiledContract);                                                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@critesjosh critesjosh added the from-community This originated from the community :) label Oct 29, 2024
rahul-kothari pushed a commit that referenced this issue Oct 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
from-community This originated from the community :)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants