Skip to content

Generating Typescript types with v2? #758

Answered by leaanthony
zb140 asked this question in Q&A
Discussion options

You must be logged in to vote

Hi there! There is a way of doing this though it's a bit hacky. If you run your app in dev mode, it will generate a node package in frontend wrapping your backend api. It's not currently exposed and dev mode is currently broken so we're not in an ideal position! The reason I say hacky is because it basically needs to run and it dumps the files based on reflection. This means that we lose the variable names.
A better approach, and much harder, is to parse the Go files of the project and generate based on that. There's a fairly robust attempt at this here but as you can see it's complicated and I just haven't got round to making it work. I did have this as part of wails generate but it look…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@zb140
Comment options

@leaanthony
Comment options

Answer selected by zb140
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants