Generating Typescript types with v2? #758
-
Hi! I just recently came across Wails, and I'm really liking it so far. Thanks for the great work! So far I haven't had much or any trouble getting things to work, but today I decided to try the v2 alpha. Is it possible to generate Typescript definitions for bindings in v2? Of course I know that an alpha is expected to have missing features, but I've seen some comments and commit messages referring to it, but I couldn't figure out how to do it. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
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 |
Beta Was this translation helpful? Give feedback.
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…