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

ts: Fix IDL type issues #1726

Closed
wants to merge 7 commits into from
Closed

Conversation

Juici
Copy link
Contributor

@Juici Juici commented Apr 4, 2022

Changelog

  • Fix the issue where nested user defined types are decoded to never.
  • Fix the issue where enums are decoded incorrectly.
  • Add type mapping to Buffer for the bytes type.

Notes

Currently the changes made would result in enum variant names being as described in the IDL, that means that no case conversion would be done, this would be a breaking change. This could be mitigated by either storing the camelcased enum variant names in the IDL, or by doing the camelcase conversion at a type level.

In terms of camelcase at a type level, I have created a demo here: https://github.com/Juici/camelcase-ts.

Add an empty prettier config file to inform editors to use it instead of
any user defaults. The empty config causes prettier to use the defaults
which are what are already in use.
@Juici Juici changed the title Fix IDL types referencing user defined types ts: Fix IDL types referencing user defined types Apr 4, 2022
@ElderJoy
Copy link

ElderJoy commented Apr 21, 2022

Hi Anchor team,
It is very useful feature. We want to use it in our project ASAP. Do you have plans about when you going to merge it?

@Juici Juici changed the title ts: Fix IDL types referencing user defined types ts: Fix IDL type issues Apr 22, 2022
@neery1218
Copy link

Hey! Also blocked by this. Are there any issues with merging?

@real-felix
Copy link

Hey, any update? This PR fixes a serious problem because, right now, all nested structures are generated as never. If you need some contribution for merging it, please tell me.

@Juici
Copy link
Contributor Author

Juici commented May 12, 2022

Any feedback from the anchor team on what is blocking this would be greatly appreciated. Currently I have to rely on using the npm package patch-package to patch the @project-serum/anchor package to apply these fixes.

@Juici
Copy link
Contributor Author

Juici commented May 7, 2023

Superceded by: #2482

@Juici Juici closed this May 7, 2023
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.

4 participants