You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When attempting to return a struct that has a generic type, the App.d.ts file is incorrectly generated and contains typos.
It is very close, but it doesn't finish out the line.
It also generates an invalid models.ts file.
I've seen similar issues with #2323 and #2303, but neither seemed to have identical problems here.
To Reproduce
I created a "dbConnection.go" file in the main package and created the following structs.
It is very close but as you can see there is a typo in the Promise return type. To manually fix it, you just have to change it to the following manually
This is a bit of a mixed bag, and I don't know how to fix it.
You'll see that first it's defining the class incorrectly.
It needs <> instead of [] for the generics. It's also using a concrete type for the class.
If we change export class QueryResult[main.UserPermissionResult] to export class QueryResult<T> then there are issues down the line with convertValues. You can't pass T as a type for classs.
I'm not sure how this would be fixed as I'm no TS expert.
Expected behaviour
The models.ts file should generate a proper class that uses generic types.
App.d.ts should finish the type declaration in the promise.
Screenshots
Attempted Fixes
For the time being, I'm going to change the return type to string and serialize the result then deserialize it on the JS side.
I've tried manually changing the generated file but was unable to find a fix due to the convertValues function unable to take a generic type.
System Details
Wails Doctor
# Wails
Version | v2.8.0
Package Manager | apt
# System
┌──────────────────────────────────────────────────────────┐
| OS | Ubuntu || Version | 22.04 || ID | ubuntu || Go Version | go1.22.0 || Platform | linux || Architecture | amd64 || CPU 1 | Intel(R) Xeon(R) Gold 6226R CPU @ 2.90GHz || CPU 2 | Intel(R) Xeon(R) Gold 6226R CPU @ 2.90GHz || GPU | SVGA II Adapter (VMware) - Driver: vmwgfx || Memory | 8GB |
└──────────────────────────────────────────────────────────┘
# Dependencies
┌──────────────────────────────────────────────────────────────────────────┐
| Dependency | Package Name | Status | Version ||*docker | docker.io | Installed | 26.0.0 || gcc | build-essential | Installed | 12.9ubuntu3 || libgtk-3 | libgtk-3-dev | Installed | 3.24.33-1ubuntu2 || libwebkit | libwebkit2gtk-4.0-dev | Installed | 2.42.5-0ubuntu0.22.04.2 || npm | npm | Installed | 10.2.4 ||*nsis | nsis | Available | 3.08-2 || pkg-config | pkg-config | Installed | 0.29.2-1ubuntu3 |
└──────────────────────── * - Optional Dependency ─────────────────────────┘
# Diagnosis
Optional package(s) installation details:
- nsis: sudo apt install nsis
Additional context
No response
The text was updated successfully, but these errors were encountered:
I've been poking around the TS generation code, may have a possible fix here for the code generation at least. It doesn't maintain the type optionality across to Typescript, but I think that will be difficult due to IPC anyway.
Description
When attempting to return a struct that has a generic type, the App.d.ts file is incorrectly generated and contains typos.
It is very close, but it doesn't finish out the line.
It also generates an invalid models.ts file.
I've seen similar issues with #2323 and #2303, but neither seemed to have identical problems here.
To Reproduce
I created a "dbConnection.go" file in the main package and created the following structs.
I then attempt to return QueryResult from a function.
The resulting "App.d.ts" file looks like this.
It is very close but as you can see there is a typo in the Promise return type. To manually fix it, you just have to change it to the following manually
As for "models.ts" the resulting file looks like this.
This is a bit of a mixed bag, and I don't know how to fix it.
You'll see that first it's defining the class incorrectly.
It needs <> instead of [] for the generics. It's also using a concrete type for the class.
If we change
export class QueryResult[main.UserPermissionResult]
toexport class QueryResult<T>
then there are issues down the line withconvertValues
. You can't pass T as a type forclasss
.I'm not sure how this would be fixed as I'm no TS expert.
Expected behaviour
The models.ts file should generate a proper class that uses generic types.
App.d.ts should finish the type declaration in the promise.
Screenshots
Attempted Fixes
For the time being, I'm going to change the return type to string and serialize the result then deserialize it on the JS side.
I've tried manually changing the generated file but was unable to find a fix due to the
convertValues
function unable to take a generic type.System Details
Additional context
No response
The text was updated successfully, but these errors were encountered: