wails: `models.ts` is not generated.
Description
When I run wails dev, I expect frontend/wailsjs/go/models.ts to be generated, but it is not.
I use wails version v2.0.0-beta.35.
To Reproduce
- Execute
wails init -t svelte-ts -d foo -n bar. - Execute
cd foo. - Add the following to
app.go.
type Foo struct{}
func (a *App) Foo() *Foo {
return &Foo{}
}
- Execute
wails dev. - I look for
frontend/wailsjs/go/models.tsbut can’t find it.
Expected behaviour
frontend/wailsjs/go/models.ts is generated.
Screenshots
No response
Attempted Fixes
In wails version v2.0.0-beta.34 frontend/wailsjs/go/models.ts is generated.
System Details
Wails CLI v2.0.0-beta.35
Scanning system - Please wait (this may take a long time)...Done.
System
------
OS: Windows 10 Home
Version: 2009 (Build: 19044)
ID: 21H2
Go Version: go1.18.1
Platform: windows
Architecture: amd64
Wails
------
Version: v2.0.0-beta.35
Dependency Package Name Status Version
---------- ------------ ------ -------
WebView2 N/A Installed 100.0.1185.50
npm N/A Installed 8.5.5
*upx N/A Installed upx 3.96
*nsis N/A Available
* - Optional Dependency
Diagnosis
---------
Your system is ready for Wails development!
Optional package(s) installation details:
- nsis : Available at https://nsis.sourceforge.io/Download
Additional context
No response
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 17 (11 by maintainers)
Hi, does your struct have json tags? Wails will only create the models.ts if your go struct has associated json:“” tags and if it exported like:
I only become aware of Wails recently thanks to the Golang Weekly newsletter. Got a little personal project it’s perfect for and I’ve started on. Once I have a bit more familiarity, and if somebody hasn’t started on it already, I’ll happily take that on.
I’d prefer this approach for sure but remember it did not working correctly for some reason back in the day. If you are happy to look at it, please open a ticket and we can stick it on the board 👍
~So @leaanthony and @mondy - is this expected behaviour? I was following the getting started guide and ran into the same issue where
App.d.tswas showing an import formodelsbutmodels.tswas nowhere to be found. This was onv2.0.0-rc.1.1.~Sorry for the noise, it was a snafu on my end.
model.tsis indeed generated.I’m wondering if it’s more desirable to leave it so it doesn’t compile, as that will tell you that you’ve got something wrong in your code. Or…we could generate a blank model with a comment that warns about this and has a link to the docs… that actually sounds reasonable to me.