wailsapp / wails

Create beautiful applications using Go
https://wails.io
MIT License
24.68k stars 1.18k forks source link

Loss of models Scope When Using map[string]*models.XX convert to go/models.ts #3709

Open Yuelioi opened 1 month ago

Yuelioi commented 1 month ago

Description

map type cant with pointer value

To Reproduce

with pointer

type Config struct {
    baseDir       string
    SystemConfig  *models.SystemConfig            `json:"system"`  
    PluginConfigs map[string]*models.PluginConfig `json:"plugins"` // here
    Test          *models.SystemConfig            `json:"test"`
}

convert to

export namespace config {

    export class Config {
        system?: models.SystemConfig;  // works well
        plugins: {[key: string]: PluginConfig}; // <==here,  error loss models.
        test?: models.SystemConfig; // works well

Expected behaviour

export namespace config {

    export class Config {
        system?: models.SystemConfig;  // works well
        plugins: {[key: string]: mdels.PluginConfig}; // 
        test?: models.SystemConfig; // works well

Screenshots

No response

Attempted Fixes

No response

System Details

┌───────────────────────────────────────────────────────────────────────────┐
| OS           | Windows 10 Pro                                             |
| Version      | 2009 (Build: 19045)                                        |
| ID           | 22H2                                                       |
| Go Version   | go1.22.1                                                   |
| Platform     | windows                                                    |
| Architecture | amd64                                                      |
| CPU          | Intel(R) Core(TM) i7-8700K                  |
| GPU          | NVIDIA GeForce GTX 1660 Ti (NVIDIA) - Driver: 31.0.15.3623 |
| Memory       | 16GB                                                       |
└───────────────────────────────────────────────────────────────────────────┘

# Dependencies
┌────────────────────────────────────────────────────────┐
| Dependency | Package Name | Status    | Version        |
| WebView2   | N/A          | Installed | 127.0.2651.105 |
| Nodejs     | N/A          | Installed | 20.11.0        |
| npm        | N/A          | Installed | 10.3.0         |
| *upx       | N/A          | Installed | upx 4.2.4      |
| *nsis      | N/A          | Available |                |
└─────────────── * - Optional Dependency ────────────────┘

Additional context

No response