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

fix: parse struct references for type generation #2552

Merged

Conversation

dominictwlee
Copy link
Contributor

@dominictwlee dominictwlee commented Apr 2, 2023

this should fix the issues in v2.4.0 where reference type structs were breaking return types in Typescript. I think the issue stems from valueType capturing what should've been part of the valuePackage group because of ".+".

This should remedy the concerns raised in #2490 around stripping the asterix. In case we need it in the future, we could capture the asterix in a new group. I've added it to the non-capturing group for now.

@OlegGulevskyy @leaanthony let me know what you think.

I've also added a few additional cases to cover promise bindings.

closes #2489

@vercel
Copy link

vercel bot commented Apr 2, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
wails-v3-docs ❌ Failed (Inspect) Apr 2, 2023 8:57am

@dominictwlee
Copy link
Contributor Author

@leaanthony bump, just following up on this to get a review, thanks!

@zllovesuki
Copy link
Contributor

👍 this looks way better

@leaanthony
Copy link
Member

👍 this looks way better

Please LMK if you test this and it fixes your issue 👍

@dominictwlee
Copy link
Contributor Author

dominictwlee commented Apr 10, 2023

https://github.com/dominictwlee/test-ts-gen

@zllovesuki minimal example. clone my fork, uncomment go.mod replace, point to local wails dir and you're good to go.

TLDR;
https://github.com/dominictwlee/test-ts-gen/blob/main/app.go#L33 <= go method
https://github.com/dominictwlee/test-ts-gen/blob/main/frontend/wailsjs/go/main/App.d.ts#L5 <= generated d.ts

@leaanthony leaanthony self-requested a review April 12, 2023 21:47
@dominictwlee
Copy link
Contributor Author

@leaanthony thanks for the review. Anything else you need from me to get this merged in?

@AlbinoDrought
Copy link
Contributor

I was updating from 2.3.1 to 2.4.1 to fix the CreateWebResourceResponse issue and experienced this Promise<any> issue, I can confirm this PR fixes it for me 🎊

@leaanthony
Copy link
Member

Thanks for this @dominictwlee. It would be good if you could update changelog.mdx under the website directory with your changes 👍

@dominictwlee dominictwlee force-pushed the dominictwlee/fix-generate-regex branch from 889b976 to 9213f14 Compare April 25, 2023 19:25
Copy link
Member

@leaanthony leaanthony left a comment

Choose a reason for hiding this comment

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

Thanks so much for this 🙏

@leaanthony leaanthony merged commit d249c22 into wailsapp:master Apr 26, 2023
@dominictwlee dominictwlee deleted the dominictwlee/fix-generate-regex branch April 27, 2023 18:59
misitebao pushed a commit that referenced this pull request May 27, 2023
* fix: parse struct references for type generation

* chore: update changelog for typescript generation fix
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.

[v2] Binding missing types after upgrading to v2.4.0
4 participants