Skip to content

fix: ts contracts codegen#8226

Closed
olehmisar wants to merge 2 commits intoAztecProtocol:masterfrom
olehmisar:fix/ts-codegen
Closed

fix: ts contracts codegen#8226
olehmisar wants to merge 2 commits intoAztecProtocol:masterfrom
olehmisar:fix/ts-codegen

Conversation

@olehmisar
Copy link
Contributor

Fixes #4152. Related #4162 and #5792.

  1. Prepends type keyword for type-only imports in generated contracts, so projects using verbatimModuleSyntax: true can typecheck successfully.
  2. Fixes invalid public override methods! syntax.
  3. Additionally, sorts generated methods by name to make it more deterministic.

I also added verbatimModuleSyntax: true to tsconfig to showcase that it fails to typecheck without type prefix.

Copy link
Contributor

@spalladino spalladino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good @olehmisar, thanks for the contribution! Could you just revert the verbatimModuleSyntax addition? In a few places we target cjs, which based on the docs seem like could fail if we have that option set:

That does have some implications when it comes to module interop though. Under this flag, ECMAScript imports and exports won’t be rewritten to require calls when your settings or file extension implied a different module system. Instead, you’ll get an error.

I'm also curious as to why you were getting an error with the public override syntax, as it's working fine within the monorepo. Maybe different ts version? Anyway, the change works well, so I'm fine with it.

@olehmisar olehmisar requested a review from spalladino August 27, 2024 20:47
Copy link
Contributor

@spalladino spalladino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks!

@olehmisar
Copy link
Contributor Author

@spalladino not sure why CI is failing...

@spalladino
Copy link
Contributor

@olehmisar unfortunately our CI setup does not play well with contributions from external users. We have set up a job to automatically create a mirror PR under a different user so it can run CI, but it's currently failing. We'll be looking into this shortly.

@spalladino
Copy link
Contributor

Let me close this one and manually open a new one. Sorry for the issue.

@spalladino spalladino closed this Aug 29, 2024
This was referenced Aug 29, 2024
spalladino added a commit that referenced this pull request Aug 29, 2024
Original PR is #8226
by @olehmisar

Another attempt, this time with the branch local to this repository,
instead of trying to merge across forks.

---------

Co-authored-by: oleh <olehmisar@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"aztec-cli codegen" typescript files fail to typecheck

3 participants