From f6ebd6b3de4707bdc1dd44d306c81c9099e8782f Mon Sep 17 00:00:00 2001 From: Lea Anthony Date: Thu, 16 Jan 2025 07:47:23 +1100 Subject: [PATCH 1/5] Breaking Change: Service method names --- docs/src/content/docs/changelog.mdx | 3 +++ docs/src/content/docs/learn/services.mdx | 22 ++++++++++---------- v3/examples/services/hashes/hashes.go | 6 +++--- v3/internal/generator/collect/service.go | 5 +++-- v3/internal/service/template/README.tmpl.md | 22 ++++++++++---------- v3/internal/service/template/service.go.tmpl | 14 ++++++------- v3/pkg/application/application.go | 8 +++---- v3/pkg/application/bindings.go | 6 +++--- v3/pkg/application/menuitem.go | 2 +- v3/pkg/application/roles.go | 4 ++-- v3/pkg/application/services.go | 8 +++---- v3/pkg/services/fileserver/fileserver.go | 12 +++++------ v3/pkg/services/kvstore/kvstore.go | 12 +++++------ v3/pkg/services/log/log.go | 10 ++++----- v3/pkg/services/sqlite/sqlite.go | 12 +++++------ 15 files changed, 75 insertions(+), 71 deletions(-) diff --git a/docs/src/content/docs/changelog.mdx b/docs/src/content/docs/changelog.mdx index c332d70d014..b1e0ce13d8b 100644 --- a/docs/src/content/docs/changelog.mdx +++ b/docs/src/content/docs/changelog.mdx @@ -25,6 +25,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Breaking Changes +- Renamed Service methods: `Name` -> `ServiceName`, `OnStartup` -> `ServiceStartup`, `OnShutdown` -> `ServiceShutdown` by [@leaanthony](https://github.com/leaanthony) + ### Added - Support aarch64 AppImage builds by [@AkshayKalose](https://github.com/AkshayKalose) in [#3981](https://github.com/wailsapp/wails/pull/3981) - Add diagnostics section to `wails doctor` by [@leaanthony](https://github.com/leaanthony) diff --git a/docs/src/content/docs/learn/services.mdx b/docs/src/content/docs/learn/services.mdx index e53b5942c1e..f555fc85623 100644 --- a/docs/src/content/docs/learn/services.mdx +++ b/docs/src/content/docs/learn/services.mdx @@ -57,23 +57,23 @@ app := application.New(application.Options{ Services can implement optional methods to hook into the application lifecycle. :::note -The `OnStartup`, `OnShutdown`, and `ServeHTTP` methods are not included in the +The `ServiceStartup`, `ServiceShutdown`, `ServiceName` and `ServeHTTP` methods are not included in the bindings generated for a service, so they are not exposed to your frontend. ::: -### Name +### ServiceName ```go -func (s *Service) Name() string +func (s *Service) ServiceName() string ``` This method returns the name of the service. It is used for logging purposes only. -### OnStartup +### ServiceStartup ```go -func (s *Service) OnStartup(ctx context.Context, options application.ServiceOptions) error +func (s *Service) ServiceStartup(ctx context.Context, options application.ServiceOptions) error ``` This method is called when the application is starting up. You can use it to @@ -81,10 +81,10 @@ initialize resources, set up connections, or perform any necessary setup tasks. The context is the application context, and the `options` parameter provides additional information about the service. -### OnShutdown +### ServiceShutdown ```go -func (s *Service) OnShutdown() error +func (s *Service) ServiceShutdown() error ``` This method is called when the application is shutting down. Use it to clean up @@ -125,11 +125,11 @@ func New(config *Config) *Service { } } -func (s *Service) Name() string { +func (s *Service) ServiceName() string { return "github.com/wailsapp/wails/v3/services/fileserver" } -func (s *Service) OnStartup(ctx context.Context, options application.ServiceOptions) error { +func (s *Service) ServiceStartup(ctx context.Context, options application.ServiceOptions) error { // Any initialization code here return nil } @@ -159,11 +159,11 @@ All requests to `/files` will be handled by the `fileserver` service. 1. During application initialization, services are registered with the application. -2. When the application starts (`app.Run()`), the `OnStartup` method of each +2. When the application starts (`app.Run()`), the `ServiceStartup` method of each service is called with the application context and service options. 3. Throughout the application's lifetime, services can perform their specific tasks. 4. If a service implements `ServeHTTP`, it can handle HTTP requests at the specified path. -5. When the application is shutting down, the `OnShutdown` method of each +5. When the application is shutting down, the `ServiceShutdown` method of each service is called as well as the context being cancelled. diff --git a/v3/examples/services/hashes/hashes.go b/v3/examples/services/hashes/hashes.go index 8c9774b5917..3a13a975f6c 100644 --- a/v3/examples/services/hashes/hashes.go +++ b/v3/examples/services/hashes/hashes.go @@ -31,12 +31,12 @@ func New() *Hashes { return &Hashes{} } -func (h *Hashes) OnShutdown() error { return nil } +func (h *Hashes) ServiceShutdown() error { return nil } -func (h *Hashes) Name() string { +func (h *Hashes) ServiceName() string { return "Hashes Service" } -func (h *Hashes) OnStartup(_ context.Context, _ application.ServiceOptions) error { +func (h *Hashes) ServiceStartup(_ context.Context, _ application.ServiceOptions) error { return nil } diff --git a/v3/internal/generator/collect/service.go b/v3/internal/generator/collect/service.go index 007b92ba524..a811e10f22f 100644 --- a/v3/internal/generator/collect/service.go +++ b/v3/internal/generator/collect/service.go @@ -56,8 +56,9 @@ type ( func isInternalServiceMethod(method *types.Func) bool { internalServiceMethods := []string{ - "OnStartup", - "OnShutdown", + "ServiceName", + "ServiceStartup", + "ServiceShutdown", "ServeHTTP", } methodName := method.Name() diff --git a/v3/internal/service/template/README.tmpl.md b/v3/internal/service/template/README.tmpl.md index bffd2a69767..065021b6a19 100644 --- a/v3/internal/service/template/README.tmpl.md +++ b/v3/internal/service/template/README.tmpl.md @@ -21,27 +21,27 @@ type MyService struct { This is the main service struct. You can rename it to better reflect your service's purpose. The struct holds a context and service options, which are set during startup. -### Name Method +### ServiceName Method ```go -func (p *MyService) Name() string +func (p *MyService) ServiceName() string ``` This method returns the name of the service. It's used to identify the service within the Wails application. -### OnStartup Method +### ServiceStartup Method ```go -func (p *MyService) OnStartup(ctx context.Context, options application.ServiceOptions) error +func (p *MyService) ServiceStartup(ctx context.Context, options application.ServiceOptions) error ``` This method is called when the app is starting up. Use it to initialize resources, set up connections, or perform any necessary setup tasks. It receives a context and service options, which are stored in the service struct. -### OnShutdown Method +### ServiceShutdown Method ```go -func (p *MyService) OnShutdown() error +func (p *MyService) ServiceShutdown() error ``` This method is called when the app is shutting down. Use it to clean up resources, close connections, or perform any necessary cleanup tasks. @@ -68,9 +68,9 @@ This is an example of a service method. You can add as many methods as you need. To create your own service: 1. Rename the `MyService` struct to reflect your service's purpose (e.g., `DatabaseService`, `AuthService`). -2. Update the `Name` method to return your service's unique identifier. -3. Implement the `OnStartup` method to initialize your service. This might include setting up database connections, loading configuration, etc. -4. If needed, implement the `OnShutdown` method to properly clean up resources when the application closes. +2. Update the `ServiceName` method to return your service's unique identifier. +3. Implement the `ServiceStartup` method to initialize your service. This might include setting up database connections, loading configuration, etc. +4. If needed, implement the `ServiceShutdown` method to properly clean up resources when the application closes. 5. If your service needs to handle HTTP requests, implement the `ServeHTTP` method. Use this to create API endpoints, serve files, or handle any HTTP interactions. 6. Add your own methods to the service. These can include database operations, business logic, or any functionality your service needs to provide. 7. If your service requires configuration, consider adding a `Config` struct and a `New` function to create and configure your service. @@ -90,7 +90,7 @@ func (s *DatabaseService) Name() string { return "github.com/myname/DatabaseService" } -func (s *DatabaseService) OnStartup(ctx context.Context, options application.ServiceOptions) error { +func (s *DatabaseService) ServiceStartup(ctx context.Context, options application.ServiceOptions) error { s.ctx = ctx s.options = options // Initialize database connection @@ -99,7 +99,7 @@ func (s *DatabaseService) OnStartup(ctx context.Context, options application.Ser return err } -func (s *DatabaseService) OnShutdown() error { +func (s *DatabaseService) ServiceShutdown() error { return s.db.Close() } diff --git a/v3/internal/service/template/service.go.tmpl b/v3/internal/service/template/service.go.tmpl index 9ba3990d9b1..781e9efff61 100644 --- a/v3/internal/service/template/service.go.tmpl +++ b/v3/internal/service/template/service.go.tmpl @@ -7,7 +7,7 @@ import ( // ---------------- Service Setup ---------------- // This is the main service struct. It can be named anything you like. -// Both the OnStartup() and OnShutdown() methods are called synchronously when the app starts and stops. +// Both the ServiceStartup() and ServiceShutdown() methods are called synchronously when the app starts and stops. // Changing the name of this struct will change the name of the services class in the frontend // Bound methods will exist inside frontend/bindings/github.com/user/{{.Name}} under the name of the struct type MyService struct{ @@ -15,25 +15,25 @@ type MyService struct{ options application.ServiceOptions } -// Name is the name of the service -func (p *MyService) Name() string { +// ServiceName is the name of the service +func (p *MyService) ServiceName() string { return "{{.Name}}" } -// OnStartup is called when the app is starting up. You can use this to +// ServiceStartup is called when the app is starting up. You can use this to // initialise any resources you need. You can also access the application // instance via the app property. // OPTIONAL: This method is optional. -func (p *MyService) OnStartup(ctx context.Context, options application.ServiceOptions) error { +func (p *MyService) ServiceStartup(ctx context.Context, options application.ServiceOptions) error { p.ctx = ctx p.options = options return nil } -// OnShutdown is called when the app is shutting down via runtime.Quit() call +// ServiceShutdown is called when the app is shutting down via runtime.Quit() call // You can use this to clean up any resources you have allocated // OPTIONAL: This method is optional. -func (p *MyService) OnShutdown() error { +func (p *MyService) ServiceShutdown() error { return nil } diff --git a/v3/pkg/application/application.go b/v3/pkg/application/application.go index 7b5298fe7e8..97937b59751 100644 --- a/v3/pkg/application/application.go +++ b/v3/pkg/application/application.go @@ -144,17 +144,17 @@ func New(appOptions Options) *App { for i, service := range appOptions.Services { if thisService, ok := service.instance.(ServiceStartup); ok { - err := thisService.OnStartup(result.ctx, service.options) + err := thisService.ServiceStartup(result.ctx, service.options) if err != nil { name := service.options.Name if name == "" { name = getServiceName(service.instance) } - globalApplication.Logger.Error("OnStartup() failed shutting down application:", "service", name, "error", err.Error()) + globalApplication.Logger.Error("ServiceStartup() failed shutting down application:", "service", name, "error", err.Error()) // Run shutdown on all services that have already started for _, service := range appOptions.Services[:i] { if thisService, ok := service.instance.(ServiceShutdown); ok { - err := thisService.OnShutdown() + err := thisService.ServiceShutdown() if err != nil { globalApplication.Logger.Error("Error shutting down service: " + err.Error()) } @@ -676,7 +676,7 @@ func (a *App) Run() error { for _, service := range a.options.Services { // If it conforms to the ServiceShutdown interface, call the Shutdown method if thisService, ok := service.instance.(ServiceShutdown); ok { - err := thisService.OnShutdown() + err := thisService.ServiceShutdown() if err != nil { a.error("Error shutting down service: " + err.Error()) } diff --git a/v3/pkg/application/bindings.go b/v3/pkg/application/bindings.go index 19ce52f337c..cc098fc1dd9 100644 --- a/v3/pkg/application/bindings.go +++ b/v3/pkg/application/bindings.go @@ -258,15 +258,15 @@ func (b *Bindings) internalMethod(def reflect.Method) bool { // Check if the instance implements any of our service interfaces // and if the method matches the interface method switch def.Name { - case "Name": + case "ServiceName": if _, ok := instance.(ServiceName); ok { return true } - case "OnStartup": + case "ServiceStartup": if _, ok := instance.(ServiceStartup); ok { return true } - case "OnShutdown": + case "ServiceShutdown": if _, ok := instance.(ServiceShutdown); ok { return true } diff --git a/v3/pkg/application/menuitem.go b/v3/pkg/application/menuitem.go index 71ea0cd00d3..d0f5d96b698 100644 --- a/v3/pkg/application/menuitem.go +++ b/v3/pkg/application/menuitem.go @@ -178,7 +178,7 @@ func NewRole(role Role) *MenuItem { result = NewZoomInMenuItem() case ZoomOut: result = NewZoomOutMenuItem() - case Minimize: + case Minimise: result = NewMinimizeMenuItem() case Zoom: result = NewZoomMenuItem() diff --git a/v3/pkg/application/roles.go b/v3/pkg/application/roles.go index a6e6f177c36..74c49c393cb 100644 --- a/v3/pkg/application/roles.go +++ b/v3/pkg/application/roles.go @@ -44,7 +44,7 @@ const ( ZoomOut Role = iota ToggleFullscreen Role = iota - Minimize Role = iota + Minimise Role = iota Zoom Role = iota FullScreen Role = iota @@ -138,7 +138,7 @@ func NewEditMenu() *MenuItem { func NewWindowMenu() *MenuItem { menu := NewMenu() - menu.AddRole(Minimize) + menu.AddRole(Minimise) menu.AddRole(Zoom) if runtime.GOOS == "darwin" { menu.AddSeparator() diff --git a/v3/pkg/application/services.go b/v3/pkg/application/services.go index 0df8cb055d6..446746299f4 100644 --- a/v3/pkg/application/services.go +++ b/v3/pkg/application/services.go @@ -6,21 +6,21 @@ import ( ) type ServiceName interface { - Name() string + ServiceName() string } type ServiceStartup interface { - OnStartup(ctx context.Context, options ServiceOptions) error + ServiceStartup(ctx context.Context, options ServiceOptions) error } type ServiceShutdown interface { - OnShutdown() error + ServiceShutdown() error } func getServiceName(service any) string { // First check it conforms to ServiceName interface if serviceName, ok := service.(ServiceName); ok { - return serviceName.Name() + return serviceName.ServiceName() } // Next, get the name from the type return reflect.TypeOf(service).String() diff --git a/v3/pkg/services/fileserver/fileserver.go b/v3/pkg/services/fileserver/fileserver.go index f4cb1a0532d..f84b649458d 100644 --- a/v3/pkg/services/fileserver/fileserver.go +++ b/v3/pkg/services/fileserver/fileserver.go @@ -26,21 +26,21 @@ func New(config *Config) *Service { } } -// OnShutdown is called when the app is shutting down +// ServiceShutdown is called when the app is shutting down // You can use this to clean up any resources you have allocated -func (s *Service) OnShutdown() error { +func (s *Service) ServiceShutdown() error { return nil } -// Name returns the name of the plugin. +// ServiceName returns the name of the plugin. // You should use the go module format e.g. github.com/myuser/myplugin -func (s *Service) Name() string { +func (s *Service) ServiceName() string { return "github.com/wailsapp/wails/v3/services/fileserver" } -// OnStartup is called when the app is starting up. You can use this to +// ServiceStartup is called when the app is starting up. You can use this to // initialise any resources you need. -func (s *Service) OnStartup(ctx context.Context, options application.ServiceOptions) error { +func (s *Service) ServiceStartup(ctx context.Context, options application.ServiceOptions) error { // Any initialization code here return nil } diff --git a/v3/pkg/services/kvstore/kvstore.go b/v3/pkg/services/kvstore/kvstore.go index 33f396a62e6..ca46dccb5b5 100644 --- a/v3/pkg/services/kvstore/kvstore.go +++ b/v3/pkg/services/kvstore/kvstore.go @@ -33,8 +33,8 @@ func New(config *Config) *KeyValueStore { } } -// OnShutdown will save the store to disk if there are unsaved changes. -func (kvs *KeyValueStore) OnShutdown() error { +// ServiceShutdown will save the store to disk if there are unsaved changes. +func (kvs *KeyValueStore) ServiceShutdown() error { if kvs.unsaved { err := kvs.Save() if err != nil { @@ -44,13 +44,13 @@ func (kvs *KeyValueStore) OnShutdown() error { return nil } -// Name returns the name of the plugin. -func (kvs *KeyValueStore) Name() string { +// ServiceName returns the name of the plugin. +func (kvs *KeyValueStore) ServiceName() string { return "github.com/wailsapp/wails/v3/plugins/kvstore" } -// OnStartup is called when the plugin is loaded. This is where you should do any setup. -func (kvs *KeyValueStore) OnStartup(ctx context.Context, options application.ServiceOptions) error { +// ServiceStartup is called when the plugin is loaded. This is where you should do any setup. +func (kvs *KeyValueStore) ServiceStartup(ctx context.Context, options application.ServiceOptions) error { err := kvs.open(kvs.config.Filename) if err != nil { return err diff --git a/v3/pkg/services/log/log.go b/v3/pkg/services/log/log.go index 64a2bcee147..dd1aafac136 100644 --- a/v3/pkg/services/log/log.go +++ b/v3/pkg/services/log/log.go @@ -41,17 +41,17 @@ func New() *LoggerService { return NewLoggerService(&Config{}) } -// OnShutdown is called when the app is shutting down +// ServiceShutdown is called when the app is shutting down // You can use this to clean up any resources you have allocated -func (l *LoggerService) OnShutdown() error { return nil } +func (l *LoggerService) ServiceShutdown() error { return nil } -// Name returns the name of the plugin. +// ServiceName returns the name of the plugin. // You should use the go module format e.g. github.com/myuser/myplugin -func (l *LoggerService) Name() string { +func (l *LoggerService) ServiceName() string { return "github.com/wailsapp/wails/v3/plugins/log" } -func (l *LoggerService) OnStartup(ctx context.Context, options application.ServiceOptions) error { +func (l *LoggerService) ServiceStartup(ctx context.Context, options application.ServiceOptions) error { // Any initialization code here return nil } diff --git a/v3/pkg/services/sqlite/sqlite.go b/v3/pkg/services/sqlite/sqlite.go index f96b345cd6d..c8cde7b7f81 100644 --- a/v3/pkg/services/sqlite/sqlite.go +++ b/v3/pkg/services/sqlite/sqlite.go @@ -27,24 +27,24 @@ func New(config *Config) *Service { } } -// OnShutdown is called when the app is shutting down +// ServiceShutdown is called when the app is shutting down // You can use this to clean up any resources you have allocated -func (s *Service) OnShutdown() error { +func (s *Service) ServiceShutdown() error { if s.conn != nil { return s.conn.Close() } return nil } -// Name returns the name of the plugin. +// ServiceName returns the name of the plugin. // You should use the go module format e.g. github.com/myuser/myplugin -func (s *Service) Name() string { +func (s *Service) ServiceName() string { return "github.com/wailsapp/wails/v3/plugins/sqlite" } -// OnStartup is called when the app is starting up. You can use this to +// ServiceStartup is called when the app is starting up. You can use this to // initialise any resources you need. -func (s *Service) OnStartup(ctx context.Context, options application.ServiceOptions) error { +func (s *Service) ServiceStartup(ctx context.Context, options application.ServiceOptions) error { if s.config.DBFile == "" { return errors.New(`no database file specified. Please set DBFile in the config to either a filename or use ":memory:" to use an in-memory database`) } From 0e02b07ba33ea75f252cc6e5f2d9f884962a0239 Mon Sep 17 00:00:00 2001 From: Lea Anthony Date: Thu, 16 Jan 2025 20:25:07 +1100 Subject: [PATCH 2/5] Fix typos --- v3/pkg/application/menuitem.go | 2 +- v3/pkg/application/menuitem_roles.go | 2 +- v3/pkg/application/menuitem_selectors_darwin.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/v3/pkg/application/menuitem.go b/v3/pkg/application/menuitem.go index d0f5d96b698..515851a086b 100644 --- a/v3/pkg/application/menuitem.go +++ b/v3/pkg/application/menuitem.go @@ -179,7 +179,7 @@ func NewRole(role Role) *MenuItem { case ZoomOut: result = NewZoomOutMenuItem() case Minimise: - result = NewMinimizeMenuItem() + result = NewMinimiseMenuItem() case Zoom: result = NewZoomMenuItem() case FullScreen: diff --git a/v3/pkg/application/menuitem_roles.go b/v3/pkg/application/menuitem_roles.go index 96dc964e0fa..4eb4e48d057 100644 --- a/v3/pkg/application/menuitem_roles.go +++ b/v3/pkg/application/menuitem_roles.go @@ -247,7 +247,7 @@ func NewZoomOutMenuItem() *MenuItem { }) } -func NewMinimizeMenuItem() *MenuItem { +func NewMinimiseMenuItem() *MenuItem { return NewMenuItem("Minimize"). SetAccelerator("CmdOrCtrl+M"). OnClick(func(ctx *Context) { diff --git a/v3/pkg/application/menuitem_selectors_darwin.go b/v3/pkg/application/menuitem_selectors_darwin.go index 0608a0edb31..3fd0018972e 100644 --- a/v3/pkg/application/menuitem_selectors_darwin.go +++ b/v3/pkg/application/menuitem_selectors_darwin.go @@ -15,7 +15,7 @@ var roleToSelector = map[Role]string{ ShowAll: "unhideAllApplications:", Quit: "terminate:", //WindowMenu: "", // This is a submenu, no direct selector - Minimize: "performMiniaturize:", + Minimise: "performMiniaturize:", Zoom: "performZoom:", BringAllToFront: "arrangeInFront:", CloseWindow: "performClose:", From 7387e62a951aececf834a168cfa09e3d26df163e Mon Sep 17 00:00:00 2001 From: Lea Anthony Date: Thu, 16 Jan 2025 20:26:24 +1100 Subject: [PATCH 3/5] Update pipeline to use Go 1.23 --- .github/workflows/build-and-test-v3.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-test-v3.yml b/.github/workflows/build-and-test-v3.yml index ef84d4189c6..88f5761041b 100644 --- a/.github/workflows/build-and-test-v3.yml +++ b/.github/workflows/build-and-test-v3.yml @@ -30,7 +30,7 @@ jobs: fail-fast: false matrix: os: [windows-latest, macos-latest, ubuntu-latest] - go-version: [1.22] + go-version: [1.23] steps: - name: Checkout code From e668c81806a91a9655fd07ad60a23c5e13f8ad1d Mon Sep 17 00:00:00 2001 From: Lea Anthony Date: Thu, 16 Jan 2025 22:08:18 +1100 Subject: [PATCH 4/5] Improved panic handling. Added guide. --- docs/src/content/docs/changelog.mdx | 1 + .../content/docs/guides/panic-handling.mdx | 111 ++++++++++++++++++ v3/examples/panic-handling/README.md | 11 ++ v3/examples/panic-handling/assets/index.html | 27 +++++ v3/examples/panic-handling/main.go | 60 ++++++++++ v3/pkg/application/application.go | 47 +++++--- v3/pkg/application/application_linux.go | 1 + v3/pkg/application/application_options.go | 2 +- v3/pkg/application/bindings.go | 20 +--- v3/pkg/application/dialogs_linux.go | 5 +- v3/pkg/application/dialogs_windows.go | 2 + v3/pkg/application/events.go | 15 ++- v3/pkg/application/linux_cgo.go | 1 + v3/pkg/application/mainthread.go | 12 +- v3/pkg/application/menuitem.go | 5 +- v3/pkg/application/messageprocessor.go | 5 + v3/pkg/application/messageprocessor_call.go | 4 +- v3/pkg/application/messageprocessor_dialog.go | 2 + v3/pkg/application/panic_handler.go | 107 +++++++++++++++++ v3/pkg/application/single_instance.go | 1 + v3/pkg/application/systemtray.go | 1 + v3/pkg/application/systemtray_linux.go | 1 + v3/pkg/application/webview_window.go | 10 +- 23 files changed, 398 insertions(+), 53 deletions(-) create mode 100644 docs/src/content/docs/guides/panic-handling.mdx create mode 100644 v3/examples/panic-handling/README.md create mode 100644 v3/examples/panic-handling/assets/index.html create mode 100644 v3/examples/panic-handling/main.go create mode 100644 v3/pkg/application/panic_handler.go diff --git a/docs/src/content/docs/changelog.mdx b/docs/src/content/docs/changelog.mdx index b1e0ce13d8b..a0aeed68d75 100644 --- a/docs/src/content/docs/changelog.mdx +++ b/docs/src/content/docs/changelog.mdx @@ -33,6 +33,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Add diagnostics section to `wails doctor` by [@leaanthony](https://github.com/leaanthony) - Add window to context when calling a service method by [@leaanthony](https://github.com/leaanthony) - Add `window-call` example to demonstrate how to know which window is calling a service by [@leaanthony](https://github.com/leaanthony) +- Better panic handling by [@leaanthony](https://github.com/leaanthony) ### Fixed - Fixed Windows+Linux Edit Menu issues by [@leaanthony](https://github.com/leaanthony) in [#3f78a3a](https://github.com/wailsapp/wails/commit/3f78a3a8ce7837e8b32242c8edbbed431c68c062) diff --git a/docs/src/content/docs/guides/panic-handling.mdx b/docs/src/content/docs/guides/panic-handling.mdx new file mode 100644 index 00000000000..5a38c444e73 --- /dev/null +++ b/docs/src/content/docs/guides/panic-handling.mdx @@ -0,0 +1,111 @@ +--- +title: Handling Panics +description: How to handle panics in your Wails application +--- + +In Go applications, panics can occur during runtime when something unexpected happens. This guide explains how to handle panics both in general Go code and specifically in your Wails application. + +## Understanding Panics in Go + +Before diving into Wails-specific panic handling, it's essential to understand how panics work in Go: + +1. Panics are for unrecoverable errors that shouldn't happen during normal operation +2. When a panic occurs in a goroutine, only that goroutine is affected +3. Panics can be recovered using `defer` and `recover()` + +Here's a basic example of panic handling in Go: + +```go +func doSomething() { + // Deferred functions run even when a panic occurs + defer func() { + if r := recover(); r != nil { + fmt.Printf("Recovered from panic: %v\n", r) + } + }() + + // Your code that might panic + panic("something went wrong") +} +``` + +For more detailed information about panic and recover in Go, see the [Go Blog: Defer, Panic, and Recover](https://go.dev/blog/defer-panic-and-recover). + +## Panic Handling in Wails + +Wails automatically handles panics that occur in your Service methods when they are called from the frontend. This means you don't need to add panic recovery to these methods - Wails will catch the panic and process it through your configured panic handler. + +The panic handler is specifically designed to catch: +- Panics in bound service methods called from the frontend +- Internal panics from the Wails runtime + +For other scenarios, such as background goroutines or standalone Go code, you should handle panics yourself using Go's standard panic recovery mechanisms. + +## The PanicDetails Struct + +When a panic occurs, Wails captures important information about the panic in a `PanicDetails` struct: + +```go +type PanicDetails struct { + StackTrace string // The stack trace of where the panic occurred. Potentially trimmed to provide more context + Error error // The error that caused the panic + Time time.Time // The time when the panic occurred + FullStackTrace string // The complete stack trace including runtime frames +} +``` + +This structure provides comprehensive information about the panic: +- `StackTrace`: A formatted string showing the call stack that led to the panic +- `Error`: The actual error or panic message +- `Time`: The exact time when the panic occurred +- `FullStackTrace`: The complete stack trace including runtime frames + +:::note[Panics in Service Code] + +When panics are caught in your Service code after being called from the frontend, the stack trace is trimmed to focus on exactly where in your code the panic occurred. +If you want to see the full stack trace, you can use the `FullStackTrace` field. + +::: + +## Default Panic Handler + +If you don't specify a custom panic handler, Wails will use its default handler which outputs error information in a formatted log message. For example: + +``` +Jan 16 21:18:05.649 ERR panic error: oh no! something went wrong deep in my service! :( +main.(*WindowService).call2 + at E:/wails/v3/examples/panic-handling/main.go:24 +main.(*WindowService).call1 + at E:/wails/v3/examples/panic-handling/main.go:20 +main.(*WindowService).GeneratePanic + at E:/wails/v3/examples/panic-handling/main.go:16 +``` + +## Custom Panic Handler + +You can implement your own panic handler by setting the `PanicHandler` option when creating your application. Here's an example: + +```go +app := application.New(application.Options{ + Name: "My App", + PanicHandler: func(panicDetails *application.PanicDetails) { + fmt.Printf("*** Custom Panic Handler ***\n") + fmt.Printf("Time: %s\n", panicDetails.Time) + fmt.Printf("Error: %s\n", panicDetails.Error) + fmt.Printf("Stacktrace: %s\n", panicDetails.StackTrace) + fmt.Printf("Full Stacktrace: %s\n", panicDetails.FullStackTrace) + + // You could also: + // - Log to a file + // - Send to a crash reporting service + // - Show a user-friendly error dialog + // - Attempt to recover or restart the application + }, +}) +``` + +For a complete working example of panic handling in a Wails application, see the panic-handling example in `v3/examples/panic-handling`. + +## Final Notes + +Remember that the Wails panic handler is specifically for managing panics in bound methods and internal runtime errors. For other parts of your application, you should use Go's standard error handling patterns and panic recovery mechanisms where appropriate. As with all Go applications, it's better to prevent panics through proper error handling where possible. diff --git a/v3/examples/panic-handling/README.md b/v3/examples/panic-handling/README.md new file mode 100644 index 00000000000..99068495f8a --- /dev/null +++ b/v3/examples/panic-handling/README.md @@ -0,0 +1,11 @@ +# Panic Handling Example + +This example is a demonstration of how to handle panics in your application. + +## Running the example + +To run the example, simply run the following command: + +```bash +go run . +``` diff --git a/v3/examples/panic-handling/assets/index.html b/v3/examples/panic-handling/assets/index.html new file mode 100644 index 00000000000..f4b5fe88608 --- /dev/null +++ b/v3/examples/panic-handling/assets/index.html @@ -0,0 +1,27 @@ + + + + + + Window Call Demo + + + + + + + + + \ No newline at end of file diff --git a/v3/examples/panic-handling/main.go b/v3/examples/panic-handling/main.go new file mode 100644 index 00000000000..1efcb153ee0 --- /dev/null +++ b/v3/examples/panic-handling/main.go @@ -0,0 +1,60 @@ +package main + +import ( + "embed" + "fmt" + "github.com/wailsapp/wails/v3/pkg/application" + "log" +) + +//go:embed assets/* +var assets embed.FS + +type WindowService struct{} + +func (s *WindowService) GeneratePanic() { + s.call1() +} + +func (s *WindowService) call1() { + s.call2() +} + +func (s *WindowService) call2() { + panic("oh no! something went wrong deep in my service! :(") +} + +// ============================================== + +func main() { + app := application.New(application.Options{ + Name: "Panic Handler Demo", + Description: "A demo of Handling Panics", + Assets: application.AssetOptions{ + Handler: application.BundledAssetFileServer(assets), + }, + Mac: application.MacOptions{ + ApplicationShouldTerminateAfterLastWindowClosed: false, + }, + Services: []application.Service{ + application.NewService(&WindowService{}), + }, + PanicHandler: func(panicDetails *application.PanicDetails) { + fmt.Printf("*** There was a panic! ***\n") + fmt.Printf("Time: %s\n", panicDetails.Time) + fmt.Printf("Error: %s\n", panicDetails.Error) + fmt.Printf("Stacktrace: %s\n", panicDetails.StackTrace) + }, + }) + + app.NewWebviewWindow(). + SetTitle("WebviewWindow 1"). + Show() + + err := app.Run() + + if err != nil { + log.Fatal(err) + } + +} diff --git a/v3/pkg/application/application.go b/v3/pkg/application/application.go index 97937b59751..edd50402456 100644 --- a/v3/pkg/application/application.go +++ b/v3/pkg/application/application.go @@ -232,17 +232,6 @@ type ( } ) -func processPanicHandlerRecover() { - h := globalApplication.options.PanicHandler - if h == nil { - return - } - - if err := recover(); err != nil { - h(err) - } -} - // Messages sent from javascript get routed here type windowMessage struct { windowId uint @@ -486,7 +475,10 @@ func (a *App) OnApplicationEvent(eventType events.ApplicationEventType, callback } a.applicationEventListeners[eventID] = append(a.applicationEventListeners[eventID], listener) if a.impl != nil { - go a.impl.on(eventID) + go func() { + defer handlePanic() + a.impl.on(eventID) + }() } return func() { @@ -537,13 +529,19 @@ func (a *App) GetPID() int { func (a *App) info(message string, args ...any) { if a.Logger != nil { - go a.Logger.Info(message, args...) + go func() { + defer handlePanic() + a.Logger.Info(message, args...) + }() } } func (a *App) debug(message string, args ...any) { if a.Logger != nil { - go a.Logger.Debug(message, args...) + go func() { + defer handlePanic() + a.Logger.Debug(message, args...) + }() } } @@ -593,9 +591,6 @@ func (a *App) NewSystemTray() *SystemTray { func (a *App) Run() error { - // Setup panic handler - defer processPanicHandlerRecover() - // Call post-create hooks err := a.preRun() if err != nil { @@ -651,7 +646,10 @@ func (a *App) Run() error { a.running = true for _, systray := range a.pendingRun { - go systray.Run() + go func() { + defer handlePanic() + systray.Run() + }() } a.pendingRun = nil @@ -687,6 +685,7 @@ func (a *App) Run() error { } func (a *App) handleApplicationEvent(event *ApplicationEvent) { + defer handlePanic() a.applicationEventListenersLock.RLock() listeners, ok := a.applicationEventListeners[event.Id] a.applicationEventListenersLock.RUnlock() @@ -708,11 +707,15 @@ func (a *App) handleApplicationEvent(event *ApplicationEvent) { } for _, listener := range listeners { - go listener.callback(event) + go func() { + defer handlePanic() + listener.callback(event) + }() } } func (a *App) handleDragAndDropMessage(event *dragAndDropMessage) { + defer handlePanic() // Get window from window map a.windowsLock.Lock() window, ok := a.windows[event.windowId] @@ -726,6 +729,7 @@ func (a *App) handleDragAndDropMessage(event *dragAndDropMessage) { } func (a *App) handleWindowMessage(event *windowMessage) { + defer handlePanic() // Get window from window map a.windowsLock.RLock() window, ok := a.windows[event.windowId] @@ -745,10 +749,12 @@ func (a *App) handleWindowMessage(event *windowMessage) { } func (a *App) handleWebViewRequest(request *webViewAssetRequest) { + defer handlePanic() a.assets.ServeWebViewRequest(request) } func (a *App) handleWindowEvent(event *windowEvent) { + defer handlePanic() // Get window from window map a.windowsLock.RLock() window, ok := a.windows[event.WindowID] @@ -761,6 +767,8 @@ func (a *App) handleWindowEvent(event *windowEvent) { } func (a *App) handleMenuItemClicked(menuItemID uint) { + defer handlePanic() + menuItem := getMenuItemByID(menuItemID) if menuItem == nil { log.Printf("MenuItem #%d not found", menuItemID) @@ -1022,6 +1030,7 @@ func (a *App) removeKeyBinding(acceleratorString string) { } func (a *App) handleWindowKeyEvent(event *windowKeyEvent) { + defer handlePanic() // Get window from window map a.windowsLock.RLock() window, ok := a.windows[event.windowId] diff --git a/v3/pkg/application/application_linux.go b/v3/pkg/application/application_linux.go index 19f789c05af..c56b668a16e 100644 --- a/v3/pkg/application/application_linux.go +++ b/v3/pkg/application/application_linux.go @@ -138,6 +138,7 @@ func (a *linuxApp) isDarkMode() bool { func (a *linuxApp) monitorThemeChanges() { go func() { + defer handlePanic() conn, err := dbus.ConnectSessionBus() if err != nil { a.parent.info("[WARNING] Failed to connect to session bus; monitoring for theme changes will not function:", err) diff --git a/v3/pkg/application/application_options.go b/v3/pkg/application/application_options.go index 25328c9c6f5..57643bb0277 100644 --- a/v3/pkg/application/application_options.go +++ b/v3/pkg/application/application_options.go @@ -84,7 +84,7 @@ type Options struct { Flags map[string]any // PanicHandler is called when a panic occurs - PanicHandler func(any) + PanicHandler func(*PanicDetails) // DisableDefaultSignalHandler disables the default signal handler DisableDefaultSignalHandler bool diff --git a/v3/pkg/application/bindings.go b/v3/pkg/application/bindings.go index cc098fc1dd9..e690e757650 100644 --- a/v3/pkg/application/bindings.go +++ b/v3/pkg/application/bindings.go @@ -280,24 +280,7 @@ var errorType = reflect.TypeFor[error]() // Call will attempt to call this bound method with the given args func (b *BoundMethod) Call(ctx context.Context, args []json.RawMessage) (returnValue interface{}, err error) { // Use a defer statement to capture panics - defer func() { - if r := recover(); r != nil { - if str, ok := r.(string); ok { - if strings.HasPrefix(str, "reflect: Call using") { - // Remove prefix - str = strings.Replace(str, "reflect: Call using ", "", 1) - // Split on "as" - parts := strings.Split(str, " as type ") - if len(parts) == 2 { - err = fmt.Errorf("invalid argument type: got '%s', expected '%s'", parts[0], parts[1]) - return - } - } - } - err = fmt.Errorf("%v", r) - } - }() - + defer handlePanic(handlePanicOptions{skipEnd: 5}) argCount := len(args) if b.needsContext { argCount++ @@ -309,7 +292,6 @@ func (b *BoundMethod) Call(ctx context.Context, args []json.RawMessage) (returnV } // Convert inputs to values of appropriate type - callArgs := make([]reflect.Value, argCount) base := 0 diff --git a/v3/pkg/application/dialogs_linux.go b/v3/pkg/application/dialogs_linux.go index 4d0e5374342..239ae9d76a8 100644 --- a/v3/pkg/application/dialogs_linux.go +++ b/v3/pkg/application/dialogs_linux.go @@ -35,7 +35,10 @@ func (m *linuxDialog) show() { if response >= 0 && response < len(m.dialog.Buttons) { button := m.dialog.Buttons[response] if button.Callback != nil { - go button.Callback() + go func() { + defer handlePanic() + button.Callback() + }() } } }) diff --git a/v3/pkg/application/dialogs_windows.go b/v3/pkg/application/dialogs_windows.go index f96484e0c7f..d944cea5a2b 100644 --- a/v3/pkg/application/dialogs_windows.go +++ b/v3/pkg/application/dialogs_windows.go @@ -152,6 +152,7 @@ func (m *windowOpenFileDialog) show() (chan string, error) { files := make(chan string) go func() { + defer handlePanic() for _, file := range result { files <- file } @@ -196,6 +197,7 @@ func (m *windowSaveFileDialog) show() (chan string, error) { return cfd.NewSaveFileDialog(config) }, false) go func() { + defer handlePanic() files <- result.(string) close(files) }() diff --git a/v3/pkg/application/events.go b/v3/pkg/application/events.go index 3accabd89de..2b5e64713bf 100644 --- a/v3/pkg/application/events.go +++ b/v3/pkg/application/events.go @@ -131,8 +131,14 @@ func (e *EventProcessor) Emit(thisEvent *CustomEvent) { } } - go e.dispatchEventToListeners(thisEvent) - go e.dispatchEventToWindows(thisEvent) + go func() { + defer handlePanic() + e.dispatchEventToListeners(thisEvent) + }() + go func() { + defer handlePanic() + e.dispatchEventToWindows(thisEvent) + }() } func (e *EventProcessor) Off(eventName string) { @@ -219,7 +225,10 @@ func (e *EventProcessor) dispatchEventToListeners(event *CustomEvent) { if listener.counter > 0 { listener.counter-- } - go listener.callback(event) + go func() { + defer handlePanic() + listener.callback(event) + }() if listener.counter == 0 { listener.delete = true diff --git a/v3/pkg/application/linux_cgo.go b/v3/pkg/application/linux_cgo.go index acc4ac19244..86d930f0360 100644 --- a/v3/pkg/application/linux_cgo.go +++ b/v3/pkg/application/linux_cgo.go @@ -1712,6 +1712,7 @@ func runChooserDialog(window pointer, allowMultiple, createFolders, showHidden b InvokeAsync(func() { response := C.gtk_dialog_run((*C.GtkDialog)(fc)) go func() { + defer handlePanic() if response == C.GTK_RESPONSE_ACCEPT { filenames := C.gtk_file_chooser_get_filenames((*C.GtkFileChooser)(fc)) iter := filenames diff --git a/v3/pkg/application/mainthread.go b/v3/pkg/application/mainthread.go index b76663aa2e0..6eb40ba9d14 100644 --- a/v3/pkg/application/mainthread.go +++ b/v3/pkg/application/mainthread.go @@ -24,7 +24,7 @@ func InvokeSync(fn func()) { var wg sync.WaitGroup wg.Add(1) globalApplication.dispatchOnMainThread(func() { - defer processPanicHandlerRecover() + defer handlePanic() fn() wg.Done() }) @@ -35,7 +35,7 @@ func InvokeSyncWithResult[T any](fn func() T) (res T) { var wg sync.WaitGroup wg.Add(1) globalApplication.dispatchOnMainThread(func() { - defer processPanicHandlerRecover() + defer handlePanic() res = fn() wg.Done() }) @@ -47,7 +47,7 @@ func InvokeSyncWithError(fn func() error) (err error) { var wg sync.WaitGroup wg.Add(1) globalApplication.dispatchOnMainThread(func() { - defer processPanicHandlerRecover() + defer handlePanic() err = fn() wg.Done() }) @@ -59,7 +59,7 @@ func InvokeSyncWithResultAndError[T any](fn func() (T, error)) (res T, err error var wg sync.WaitGroup wg.Add(1) globalApplication.dispatchOnMainThread(func() { - defer processPanicHandlerRecover() + defer handlePanic() res, err = fn() wg.Done() }) @@ -71,7 +71,7 @@ func InvokeSyncWithResultAndOther[T any, U any](fn func() (T, U)) (res T, other var wg sync.WaitGroup wg.Add(1) globalApplication.dispatchOnMainThread(func() { - defer processPanicHandlerRecover() + defer handlePanic() res, other = fn() wg.Done() }) @@ -81,7 +81,7 @@ func InvokeSyncWithResultAndOther[T any, U any](fn func() (T, U)) (res T, other func InvokeAsync(fn func()) { globalApplication.dispatchOnMainThread(func() { - defer processPanicHandlerRecover() + defer handlePanic() fn() }) } diff --git a/v3/pkg/application/menuitem.go b/v3/pkg/application/menuitem.go index 515851a086b..7bce23ee79e 100644 --- a/v3/pkg/application/menuitem.go +++ b/v3/pkg/application/menuitem.go @@ -262,7 +262,10 @@ func (m *MenuItem) handleClick() { } } if m.callback != nil { - go m.callback(ctx) + go func() { + defer handlePanic() + m.callback(ctx) + }() } } diff --git a/v3/pkg/application/messageprocessor.go b/v3/pkg/application/messageprocessor.go index dd47ddf17c4..1ba2368bfdc 100644 --- a/v3/pkg/application/messageprocessor.go +++ b/v3/pkg/application/messageprocessor.go @@ -83,6 +83,11 @@ func (m *MessageProcessor) ServeHTTP(rw http.ResponseWriter, r *http.Request) { } func (m *MessageProcessor) HandleRuntimeCallWithIDs(rw http.ResponseWriter, r *http.Request) { + defer func() { + if handlePanic() { + rw.WriteHeader(http.StatusInternalServerError) + } + }() object, err := strconv.Atoi(r.URL.Query().Get("object")) if err != nil { m.httpError(rw, "Error decoding object value: "+err.Error()) diff --git a/v3/pkg/application/messageprocessor_call.go b/v3/pkg/application/messageprocessor_call.go index 4848d64180c..26ea5188e8a 100644 --- a/v3/pkg/application/messageprocessor_call.go +++ b/v3/pkg/application/messageprocessor_call.go @@ -104,6 +104,7 @@ func (m *MessageProcessor) processCallMethod(method int, rw http.ResponseWriter, } go func() { + defer handlePanic() defer func() { cancel() @@ -114,7 +115,8 @@ func (m *MessageProcessor) processCallMethod(method int, rw http.ResponseWriter, result, err := boundMethod.Call(ctx, options.Args) if err != nil { - m.callErrorCallback(window, "Error calling method: %s", callID, err) + msg := fmt.Sprintf("Error calling method '%v'", boundMethod.Name) + m.callErrorCallback(window, msg+": %s", callID, err) return } var jsonResult = []byte("{}") diff --git a/v3/pkg/application/messageprocessor_dialog.go b/v3/pkg/application/messageprocessor_dialog.go index bbddd4e6b43..8e0089ddbba 100644 --- a/v3/pkg/application/messageprocessor_dialog.go +++ b/v3/pkg/application/messageprocessor_dialog.go @@ -107,6 +107,7 @@ func (m *MessageProcessor) processDialogMethod(method int, rw http.ResponseWrite dialog := OpenFileDialogWithOptions(&options) go func() { + defer handlePanic() if options.AllowsMultipleSelection { files, err := dialog.PromptForMultipleSelection() if err != nil { @@ -148,6 +149,7 @@ func (m *MessageProcessor) processDialogMethod(method int, rw http.ResponseWrite dialog := SaveFileDialogWithOptions(&options) go func() { + defer handlePanic() file, err := dialog.PromptForSingleSelection() if err != nil { m.dialogErrorCallback(window, "Error getting selection: %s", dialogID, err) diff --git a/v3/pkg/application/panic_handler.go b/v3/pkg/application/panic_handler.go new file mode 100644 index 00000000000..de2d9ab3df9 --- /dev/null +++ b/v3/pkg/application/panic_handler.go @@ -0,0 +1,107 @@ +package application + +import ( + "fmt" + "runtime" + "runtime/debug" + "strings" + "time" +) + +func getStackTrace(skipStart int, skipEnd int) string { + // Get all program counters first + pc := make([]uintptr, 32) + n := runtime.Callers(skipStart+1, pc) + if n == 0 { + return "" + } + + pc = pc[:n] + frames := runtime.CallersFrames(pc) + + // Collect all frames first + var allFrames []runtime.Frame + for { + frame, more := frames.Next() + allFrames = append(allFrames, frame) + if !more { + break + } + } + + // Remove frames from the end + if len(allFrames) > skipEnd { + allFrames = allFrames[:len(allFrames)-skipEnd] + } + + // Build the output string + var builder strings.Builder + for _, frame := range allFrames { + fmt.Fprintf(&builder, "%s\n\tat %s:%d\n", + frame.Function, frame.File, frame.Line) + } + return builder.String() +} + +type handlePanicOptions struct { + skipEnd int +} + +type PanicDetails struct { + StackTrace string + Error error + Time time.Time + FullStackTrace string +} + +func newPanicDetails(err error, trace string) *PanicDetails { + return &PanicDetails{ + Error: err, + Time: time.Now(), + StackTrace: trace, + FullStackTrace: string(debug.Stack()), + } +} + +// handlePanic handles any panics +// Returns the error if there was one +func handlePanic(options ...handlePanicOptions) bool { + // Try to recover + e := recover() + if e == nil { + return false + } + + // Get the error + var err error + if errPanic, ok := e.(error); ok { + err = errPanic + } else { + err = fmt.Errorf("%v", e) + } + + // Get the stack trace + var stackTrace string + skipEnd := 0 + if len(options) > 0 { + skipEnd = options[0].skipEnd + } + stackTrace = getStackTrace(3, skipEnd) + + processPanic(newPanicDetails(err, stackTrace)) + return false +} + +func processPanic(panicDetails *PanicDetails) { + h := globalApplication.options.PanicHandler + if h != nil { + h(panicDetails) + return + } + defaultPanicHandler(panicDetails) +} + +func defaultPanicHandler(panicDetails *PanicDetails) { + errorMessage := fmt.Sprintf("panic error: %s\n%s", panicDetails.Error.Error(), panicDetails.StackTrace) + globalApplication.error(errorMessage) +} diff --git a/v3/pkg/application/single_instance.go b/v3/pkg/application/single_instance.go index 43270ede16e..24bbf5c3191 100644 --- a/v3/pkg/application/single_instance.go +++ b/v3/pkg/application/single_instance.go @@ -74,6 +74,7 @@ func newSingleInstanceManager(app *App, options *SingleInstanceOptions) (*single // Launch second instance data listener once.Do(func() { go func() { + defer handlePanic() for encryptedData := range secondInstanceBuffer { var secondInstanceData SecondInstanceData var jsonData []byte diff --git a/v3/pkg/application/systemtray.go b/v3/pkg/application/systemtray.go index fa117e51cea..2df93b64a32 100644 --- a/v3/pkg/application/systemtray.go +++ b/v3/pkg/application/systemtray.go @@ -109,6 +109,7 @@ func (s *SystemTray) Run() { } s.attachedWindow.justClosed = true go func() { + defer handlePanic() time.Sleep(s.attachedWindow.Debounce) s.attachedWindow.justClosed = false }() diff --git a/v3/pkg/application/systemtray_linux.go b/v3/pkg/application/systemtray_linux.go index ad6fa358d8c..10908e7e022 100644 --- a/v3/pkg/application/systemtray_linux.go +++ b/v3/pkg/application/systemtray_linux.go @@ -331,6 +331,7 @@ func (s *linuxSystemTray) run() { } s.setLabel(s.label) go func() { + defer handlePanic() s.register() if err := conn.AddMatchSignal( diff --git a/v3/pkg/application/webview_window.go b/v3/pkg/application/webview_window.go index a49511d12e6..866b8fa7054 100644 --- a/v3/pkg/application/webview_window.go +++ b/v3/pkg/application/webview_window.go @@ -793,7 +793,10 @@ func (w *WebviewWindow) HandleWindowEvent(id uint) { } for _, listener := range w.eventListeners[id] { - go listener.callback(thisEvent) + go func() { + defer handlePanic() + listener.callback(thisEvent) + }() } w.dispatchWindowEvent(id) } @@ -1261,7 +1264,10 @@ func (w *WebviewWindow) processKeyBinding(acceleratorString string) bool { defer w.keyBindingsLock.RUnlock() if callback := w.keyBindings[acceleratorString]; callback != nil { // Execute callback - go callback(w) + go func() { + defer handlePanic() + callback(w) + }() return true } } From f01b4b9a211cac7643d477aec647732db44e94c7 Mon Sep 17 00:00:00 2001 From: Fabio Massaioli Date: Fri, 17 Jan 2025 08:56:07 +0100 Subject: [PATCH 5/5] [v3] Fix binding generator bugs (#4001) * Add some clarifying comments * Remove special handling of window parameters * Improve internal method exclusion * Add test for internal method exclusion * Remove useless blank field from app options This is a leftover from an older version of the static analyser. It should have been removed long ago. * Remove redundant godebug setting gotypesalias=1 is the default starting with go1.23 * Use new range for syntax to simplify code * Remove generator dependency on github.com/samber/lo * Ensure generator testing tasks do not use the test cache * Rename cyclic types test * Test for cyclic imports * Fix import cycle between model files * Sort class aliases after their aliased class * Test class aliases * Fix length of default value for array types * Test array initialization * Add changelog * Update changelog * Fix contrived marking technique in model sorting algorithm * Update binding example * Update test data --------- Co-authored-by: Lea Anthony --- docs/src/content/docs/changelog.mdx | 7 + .../v3/examples/binding/data/internal.js | 55 ++++ .../wails/v3/examples/binding/data/models.js | 54 +--- v3/internal/generator/Taskfile.yaml | 11 +- v3/internal/generator/analyse.go | 119 ++++----- v3/internal/generator/analyse_test.go | 9 +- v3/internal/generator/collect/imports.go | 12 +- v3/internal/generator/collect/index.go | 49 ++-- v3/internal/generator/collect/properties.go | 4 +- v3/internal/generator/collect/service.go | 47 +--- v3/internal/generator/errors.go | 7 +- v3/internal/generator/generate.go | 55 ++-- v3/internal/generator/includes.go | 4 +- v3/internal/generator/models.go | 48 +--- v3/internal/generator/render/create.go | 6 +- v3/internal/generator/render/default.go | 14 +- v3/internal/generator/render/renderer.go | 66 ++++- v3/internal/generator/render/templates.go | 8 +- .../generator/render/templates/index.tmpl | 2 +- .../{models.js.tmpl => internal.js.tmpl} | 18 +- .../{models.ts.tmpl => internal.ts.tmpl} | 13 +- .../generator/render/templates/models.tmpl | 94 +++++++ .../render/templates/service.js.tmpl | 7 +- .../render/templates/service.ts.tmpl | 7 +- v3/internal/generator/render/type.go | 6 +- .../generator/testcases/aliases/main.go | 19 +- .../bound_types.json | 0 .../testcases/cyclic_imports/main.go | 55 ++++ .../testcases/cyclic_types/bound_types.json | 3 + .../{cycles => cyclic_types}/main.go | 0 .../function_single_internal/bound_types.json | 3 + .../function_single_internal/main.go | 61 +++++ .../testcases/no_bindings_here/person.go | 3 +- .../testcases/no_bindings_here/somemethods.go | 2 +- .../testcases/aliases/greetservice.js | 20 +- .../generator/testcases/aliases/internal.js | 166 ++++++++++++ .../generator/testcases/aliases/models.js | 140 ++--------- .../testcases/complex_json/greetservice.js | 2 +- .../testcases/complex_json/internal.js | 226 +++++++++++++++++ .../testcases/complex_json/models.js | 236 +----------------- .../testcases/complex_method/greetservice.js | 2 +- .../testcases/complex_method/internal.js | 38 +++ .../testcases/complex_method/models.js | 37 +-- .../testcases/cyclic_imports/greetservice.js | 35 +++ .../{cycles => cyclic_imports}/index.js | 0 .../testcases/cyclic_imports/internal.js | 164 ++++++++++++ .../testcases/cyclic_imports/models.js | 9 + .../{cycles => cyclic_types}/greetservice.js | 2 +- .../testcases/cyclic_types}/index.js | 0 .../models.js => cyclic_types/internal.js} | 0 .../testcases/cyclic_types/models.js | 18 ++ .../generator/testcases/enum/greetservice.js | 2 +- .../generator/testcases/enum/internal.js | 66 +++++ .../generator/testcases/enum/models.js | 66 +---- .../services/internal.js | 27 ++ .../services/models.js | 26 +- .../greetservice.js | 2 +- .../internal.js | 57 +++++ .../function_from_imported_package/models.js | 56 +---- .../services/internal.js | 49 ++++ .../services/models.js | 48 +--- .../services/otherservice.js | 2 +- .../greetservice.js | 2 +- .../internal.js | 54 ++++ .../models.js | 53 +--- .../services/other/internal.js | 49 ++++ .../services/other/models.js | 48 +--- .../services/other/otherservice.js | 2 +- .../function_single_internal/greetservice.js | 22 ++ .../function_single_internal/index.js | 8 + .../testcases/no_bindings_here/internal.js | 137 ++++++++++ .../testcases/no_bindings_here/models.js | 124 +-------- .../no_bindings_here/other/internal.js | 60 +++++ .../no_bindings_here/other/models.js | 59 +---- .../testcases/no_bindings_here/somemethods.js | 10 +- .../testcases/out_of_tree/embedservice.js | 8 +- .../greetservice.js | 2 +- .../struct_literal_multiple_other/internal.js | 54 ++++ .../struct_literal_multiple_other/models.js | 53 +--- .../services/internal.js | 49 ++++ .../services/models.js | 48 +--- .../services/otherservice.js | 2 +- .../greetservice.js | 2 +- .../internal.js | 57 +++++ .../models.js | 56 +---- .../struct_literal_single/greetservice.js | 2 +- .../struct_literal_single/internal.js | 57 +++++ .../testcases/struct_literal_single/models.js | 56 +---- .../greetservice.js | 2 +- .../internal.js | 58 +++++ .../models.js | 57 +---- .../services/internal.js | 49 ++++ .../services/models.js | 48 +--- .../services/otherservice.js | 2 +- .../testcases/aliases/greetservice.js | 20 +- .../generator/testcases/aliases/internal.js | 166 ++++++++++++ .../generator/testcases/aliases/models.js | 140 ++--------- .../testcases/complex_json/greetservice.js | 2 +- .../testcases/complex_json/internal.js | 226 +++++++++++++++++ .../testcases/complex_json/models.js | 236 +----------------- .../testcases/complex_method/greetservice.js | 2 +- .../testcases/complex_method/internal.js | 38 +++ .../testcases/complex_method/models.js | 37 +-- .../testcases/cyclic_imports/greetservice.js | 35 +++ .../testcases/cyclic_imports}/index.js | 0 .../testcases/cyclic_imports/internal.js | 164 ++++++++++++ .../testcases/cyclic_imports/models.js | 9 + .../{cycles => cyclic_types}/greetservice.js | 2 +- .../testcases/cyclic_types}/index.js | 0 .../models.js => cyclic_types/internal.js} | 0 .../testcases/cyclic_types/models.js | 18 ++ .../generator/testcases/enum/greetservice.js | 2 +- .../generator/testcases/enum/internal.js | 66 +++++ .../generator/testcases/enum/models.js | 66 +---- .../services/internal.js | 27 ++ .../services/models.js | 26 +- .../greetservice.js | 2 +- .../internal.js | 57 +++++ .../function_from_imported_package/models.js | 56 +---- .../services/internal.js | 49 ++++ .../services/models.js | 48 +--- .../services/otherservice.js | 2 +- .../greetservice.js | 2 +- .../internal.js | 54 ++++ .../models.js | 53 +--- .../services/other/internal.js | 49 ++++ .../services/other/models.js | 48 +--- .../services/other/otherservice.js | 2 +- .../function_single_internal/greetservice.js | 22 ++ .../function_single_internal/index.js | 8 + .../testcases/no_bindings_here/internal.js | 137 ++++++++++ .../testcases/no_bindings_here/models.js | 124 +-------- .../no_bindings_here/other/internal.js | 60 +++++ .../no_bindings_here/other/models.js | 59 +---- .../testcases/no_bindings_here/somemethods.js | 10 +- .../testcases/out_of_tree/embedservice.js | 8 +- .../greetservice.js | 2 +- .../struct_literal_multiple_other/internal.js | 54 ++++ .../struct_literal_multiple_other/models.js | 53 +--- .../services/internal.js | 49 ++++ .../services/models.js | 48 +--- .../services/otherservice.js | 2 +- .../greetservice.js | 2 +- .../internal.js | 57 +++++ .../models.js | 56 +---- .../struct_literal_single/greetservice.js | 2 +- .../struct_literal_single/internal.js | 57 +++++ .../testcases/struct_literal_single/models.js | 56 +---- .../greetservice.js | 2 +- .../internal.js | 58 +++++ .../models.js | 57 +---- .../services/internal.js | 49 ++++ .../services/models.js | 48 +--- .../services/otherservice.js | 2 +- .../testcases/aliases/greetservice.js | 16 +- .../generator/testcases/aliases/internal.js | 65 +++++ .../generator/testcases/aliases/models.js | 44 ++-- .../testcases/complex_json/greetservice.js | 2 +- .../testcases/complex_json/internal.js | 56 ++++- .../testcases/complex_json/models.js | 54 +--- .../testcases/complex_method/greetservice.js | 2 +- .../testcases/complex_method/internal.js | 13 + .../testcases/complex_method/models.js | 8 +- .../testcases/cyclic_imports/greetservice.js | 25 ++ .../testcases/cyclic_imports/index.js | 10 + .../testcases/cyclic_imports/internal.js | 32 +++ .../testcases/cyclic_imports/models.js | 17 ++ .../{cycles => cyclic_types}/greetservice.js | 2 +- .../generator/testcases/cyclic_types/index.js | 10 + .../models.js => cyclic_types/internal.js} | 9 +- .../testcases/cyclic_types/models.js | 18 ++ .../generator/testcases/enum/greetservice.js | 2 +- .../generator/testcases/enum/internal.js | 35 +++ .../generator/testcases/enum/models.js | 32 +-- .../services/internal.js | 27 ++ .../services/models.js | 27 +- .../greetservice.js | 2 +- .../internal.js | 18 ++ .../function_from_imported_package/models.js | 13 +- .../services/internal.js | 14 ++ .../services/models.js | 10 +- .../services/otherservice.js | 2 +- .../greetservice.js | 2 +- .../internal.js | 17 ++ .../models.js | 13 +- .../services/other/internal.js | 14 ++ .../services/other/models.js | 10 +- .../services/other/otherservice.js | 2 +- .../function_single_internal/greetservice.js | 22 ++ .../function_single_internal/index.js | 8 + .../testcases/no_bindings_here/internal.js | 32 ++- .../testcases/no_bindings_here/models.js | 21 +- .../no_bindings_here/other/internal.js | 15 ++ .../no_bindings_here/other/models.js | 9 +- .../testcases/no_bindings_here/somemethods.js | 4 +- .../testcases/out_of_tree/embedservice.js | 2 +- .../greetservice.js | 2 +- .../struct_literal_multiple_other/internal.js | 17 ++ .../struct_literal_multiple_other/models.js | 13 +- .../services/internal.js | 14 ++ .../services/models.js | 10 +- .../services/otherservice.js | 2 +- .../greetservice.js | 2 +- .../internal.js | 14 ++ .../models.js | 10 +- .../struct_literal_single/greetservice.js | 2 +- .../struct_literal_single/internal.js | 14 ++ .../testcases/struct_literal_single/models.js | 10 +- .../greetservice.js | 2 +- .../internal.js | 19 ++ .../models.js | 13 +- .../services/internal.js | 14 ++ .../services/models.js | 10 +- .../services/otherservice.js | 2 +- .../testcases/aliases/greetservice.js | 16 +- .../generator/testcases/aliases/internal.js | 65 +++++ .../generator/testcases/aliases/models.js | 44 ++-- .../testcases/complex_json/greetservice.js | 2 +- .../testcases/complex_json/internal.js | 56 ++++- .../testcases/complex_json/models.js | 54 +--- .../testcases/complex_method/greetservice.js | 2 +- .../testcases/complex_method/internal.js | 13 + .../testcases/complex_method/models.js | 8 +- .../testcases/cyclic_imports/greetservice.js | 25 ++ .../testcases/cyclic_imports/index.js | 10 + .../testcases/cyclic_imports/internal.js | 32 +++ .../testcases/cyclic_imports/models.js | 17 ++ .../{cycles => cyclic_types}/greetservice.js | 2 +- .../generator/testcases/cyclic_types/index.js | 10 + .../models.js => cyclic_types/internal.js} | 9 +- .../testcases/cyclic_types/models.js | 18 ++ .../generator/testcases/enum/greetservice.js | 2 +- .../generator/testcases/enum/internal.js | 35 +++ .../generator/testcases/enum/models.js | 32 +-- .../services/internal.js | 27 ++ .../services/models.js | 27 +- .../greetservice.js | 2 +- .../internal.js | 18 ++ .../function_from_imported_package/models.js | 13 +- .../services/internal.js | 14 ++ .../services/models.js | 10 +- .../services/otherservice.js | 2 +- .../greetservice.js | 2 +- .../internal.js | 17 ++ .../models.js | 13 +- .../services/other/internal.js | 14 ++ .../services/other/models.js | 10 +- .../services/other/otherservice.js | 2 +- .../function_single_internal/greetservice.js | 22 ++ .../function_single_internal/index.js | 8 + .../testcases/no_bindings_here/internal.js | 32 ++- .../testcases/no_bindings_here/models.js | 21 +- .../no_bindings_here/other/internal.js | 15 ++ .../no_bindings_here/other/models.js | 9 +- .../testcases/no_bindings_here/somemethods.js | 4 +- .../testcases/out_of_tree/embedservice.js | 2 +- .../greetservice.js | 2 +- .../struct_literal_multiple_other/internal.js | 17 ++ .../struct_literal_multiple_other/models.js | 13 +- .../services/internal.js | 14 ++ .../services/models.js | 10 +- .../services/otherservice.js | 2 +- .../greetservice.js | 2 +- .../internal.js | 14 ++ .../models.js | 10 +- .../struct_literal_single/greetservice.js | 2 +- .../struct_literal_single/internal.js | 14 ++ .../testcases/struct_literal_single/models.js | 10 +- .../greetservice.js | 2 +- .../internal.js | 19 ++ .../models.js | 13 +- .../services/internal.js | 14 ++ .../services/models.js | 10 +- .../services/otherservice.js | 2 +- .../testcases/aliases/greetservice.ts | 18 +- .../generator/testcases/aliases/internal.ts | 157 ++++++++++++ .../generator/testcases/aliases/models.ts | 148 ++--------- .../testcases/complex_json/greetservice.ts | 2 +- .../testcases/complex_json/internal.ts | 197 +++++++++++++++ .../testcases/complex_json/models.ts | 213 +--------------- .../testcases/complex_method/greetservice.ts | 2 +- .../testcases/complex_method/internal.ts | 30 +++ .../testcases/complex_method/models.ts | 30 +-- .../testcases/cyclic_imports/greetservice.ts | 33 +++ .../{cycles => cyclic_imports}/index.ts | 0 .../testcases/cyclic_imports/internal.ts | 131 ++++++++++ .../testcases/cyclic_imports/models.ts | 8 + .../{cycles => cyclic_types}/greetservice.ts | 2 +- .../testcases/cyclic_types}/index.ts | 0 .../models.ts => cyclic_types/internal.ts} | 0 .../testcases/cyclic_types/models.ts | 8 + .../generator/testcases/enum/greetservice.ts | 2 +- .../generator/testcases/enum/internal.ts | 53 ++++ .../generator/testcases/enum/models.ts | 54 +--- .../services/internal.ts | 22 ++ .../services/models.ts | 22 +- .../greetservice.ts | 2 +- .../internal.ts | 46 ++++ .../function_from_imported_package/models.ts | 46 +--- .../services/internal.ts | 35 +++ .../services/models.ts | 35 +-- .../services/otherservice.ts | 2 +- .../greetservice.ts | 2 +- .../internal.ts | 43 ++++ .../models.ts | 43 +--- .../services/other/internal.ts | 35 +++ .../services/other/models.ts | 35 +-- .../services/other/otherservice.ts | 2 +- .../function_single_internal/greetservice.ts | 19 ++ .../function_single_internal/index.ts | 7 + .../testcases/no_bindings_here/internal.ts | 125 ++++++++++ .../testcases/no_bindings_here/models.ts | 112 +-------- .../no_bindings_here/other/internal.ts | 52 ++++ .../no_bindings_here/other/models.ts | 52 +--- .../testcases/no_bindings_here/somemethods.ts | 10 +- .../testcases/out_of_tree/embedservice.ts | 8 +- .../greetservice.ts | 2 +- .../struct_literal_multiple_other/internal.ts | 43 ++++ .../struct_literal_multiple_other/models.ts | 43 +--- .../services/internal.ts | 35 +++ .../services/models.ts | 35 +-- .../services/otherservice.ts | 2 +- .../greetservice.ts | 2 +- .../internal.ts | 43 ++++ .../models.ts | 43 +--- .../struct_literal_single/greetservice.ts | 2 +- .../struct_literal_single/internal.ts | 43 ++++ .../testcases/struct_literal_single/models.ts | 43 +--- .../greetservice.ts | 2 +- .../internal.ts | 47 ++++ .../models.ts | 47 +--- .../services/internal.ts | 35 +++ .../services/models.ts | 35 +-- .../services/otherservice.ts | 2 +- .../testcases/aliases/greetservice.ts | 18 +- .../generator/testcases/aliases/internal.ts | 157 ++++++++++++ .../generator/testcases/aliases/models.ts | 148 ++--------- .../testcases/complex_json/greetservice.ts | 2 +- .../testcases/complex_json/internal.ts | 197 +++++++++++++++ .../testcases/complex_json/models.ts | 213 +--------------- .../testcases/complex_method/greetservice.ts | 2 +- .../testcases/complex_method/internal.ts | 30 +++ .../testcases/complex_method/models.ts | 30 +-- .../testcases/cyclic_imports/greetservice.ts | 33 +++ .../testcases/cyclic_imports}/index.ts | 0 .../testcases/cyclic_imports/internal.ts | 131 ++++++++++ .../testcases/cyclic_imports/models.ts | 8 + .../{cycles => cyclic_types}/greetservice.ts | 2 +- .../testcases/cyclic_types}/index.ts | 0 .../models.ts => cyclic_types/internal.ts} | 0 .../testcases/cyclic_types/models.ts | 8 + .../generator/testcases/enum/greetservice.ts | 2 +- .../generator/testcases/enum/internal.ts | 53 ++++ .../generator/testcases/enum/models.ts | 54 +--- .../services/internal.ts | 22 ++ .../services/models.ts | 22 +- .../greetservice.ts | 2 +- .../internal.ts | 46 ++++ .../function_from_imported_package/models.ts | 46 +--- .../services/internal.ts | 35 +++ .../services/models.ts | 35 +-- .../services/otherservice.ts | 2 +- .../greetservice.ts | 2 +- .../internal.ts | 43 ++++ .../models.ts | 43 +--- .../services/other/internal.ts | 35 +++ .../services/other/models.ts | 35 +-- .../services/other/otherservice.ts | 2 +- .../function_single_internal/greetservice.ts | 19 ++ .../function_single_internal/index.ts | 7 + .../testcases/no_bindings_here/internal.ts | 125 ++++++++++ .../testcases/no_bindings_here/models.ts | 112 +-------- .../no_bindings_here/other/internal.ts | 52 ++++ .../no_bindings_here/other/models.ts | 52 +--- .../testcases/no_bindings_here/somemethods.ts | 10 +- .../testcases/out_of_tree/embedservice.ts | 8 +- .../greetservice.ts | 2 +- .../struct_literal_multiple_other/internal.ts | 43 ++++ .../struct_literal_multiple_other/models.ts | 43 +--- .../services/internal.ts | 35 +++ .../services/models.ts | 35 +-- .../services/otherservice.ts | 2 +- .../greetservice.ts | 2 +- .../internal.ts | 43 ++++ .../models.ts | 43 +--- .../struct_literal_single/greetservice.ts | 2 +- .../struct_literal_single/internal.ts | 43 ++++ .../testcases/struct_literal_single/models.ts | 43 +--- .../greetservice.ts | 2 +- .../internal.ts | 47 ++++ .../models.ts | 47 +--- .../services/internal.ts | 35 +++ .../services/models.ts | 35 +-- .../services/otherservice.ts | 2 +- .../testcases/aliases/greetservice.ts | 14 +- .../generator/testcases/aliases/internal.ts | 81 ++++++ .../generator/testcases/aliases/models.ts | 80 +----- .../testcases/complex_json/greetservice.ts | 2 +- .../testcases/complex_json/internal.ts | 104 ++++++++ .../testcases/complex_json/models.ts | 118 +-------- .../testcases/complex_method/greetservice.ts | 2 +- .../testcases/complex_method/internal.ts | 9 + .../testcases/complex_method/models.ts | 10 +- .../testcases/cyclic_imports/greetservice.ts | 23 ++ .../testcases/cyclic_imports/index.ts | 9 + .../testcases/cyclic_imports/internal.ts | 21 ++ .../testcases/cyclic_imports/models.ts | 8 + .../{cycles => cyclic_types}/greetservice.ts | 2 +- .../generator/testcases/cyclic_types/index.ts | 9 + .../models.ts => cyclic_types/internal.ts} | 1 - .../testcases/cyclic_types/models.ts | 8 + .../generator/testcases/enum/greetservice.ts | 2 +- .../generator/testcases/enum/internal.ts | 29 +++ .../generator/testcases/enum/models.ts | 32 +-- .../services/internal.ts | 18 ++ .../services/models.ts | 19 +- .../greetservice.ts | 2 +- .../internal.ts | 14 ++ .../function_from_imported_package/models.ts | 15 +- .../services/internal.ts | 8 + .../services/models.ts | 9 +- .../services/otherservice.ts | 2 +- .../greetservice.ts | 2 +- .../internal.ts | 11 + .../models.ts | 12 +- .../services/other/internal.ts | 8 + .../services/other/models.ts | 9 +- .../services/other/otherservice.ts | 2 +- .../function_single_internal/greetservice.ts | 19 ++ .../function_single_internal/index.ts | 7 + .../testcases/no_bindings_here/internal.ts | 39 +++ .../testcases/no_bindings_here/models.ts | 40 +-- .../no_bindings_here/other/internal.ts | 17 ++ .../no_bindings_here/other/models.ts | 18 +- .../testcases/no_bindings_here/somemethods.ts | 4 +- .../testcases/out_of_tree/embedservice.ts | 2 +- .../greetservice.ts | 2 +- .../struct_literal_multiple_other/internal.ts | 11 + .../struct_literal_multiple_other/models.ts | 12 +- .../services/internal.ts | 8 + .../services/models.ts | 9 +- .../services/otherservice.ts | 2 +- .../greetservice.ts | 2 +- .../internal.ts | 8 + .../models.ts | 9 +- .../struct_literal_single/greetservice.ts | 2 +- .../struct_literal_single/internal.ts | 8 + .../testcases/struct_literal_single/models.ts | 9 +- .../greetservice.ts | 2 +- .../internal.ts | 15 ++ .../models.ts | 16 +- .../services/internal.ts | 8 + .../services/models.ts | 9 +- .../services/otherservice.ts | 2 +- .../testcases/aliases/greetservice.ts | 14 +- .../generator/testcases/aliases/internal.ts | 81 ++++++ .../generator/testcases/aliases/models.ts | 80 +----- .../testcases/complex_json/greetservice.ts | 2 +- .../testcases/complex_json/internal.ts | 104 ++++++++ .../testcases/complex_json/models.ts | 118 +-------- .../testcases/complex_method/greetservice.ts | 2 +- .../testcases/complex_method/internal.ts | 9 + .../testcases/complex_method/models.ts | 10 +- .../testcases/cyclic_imports/greetservice.ts | 23 ++ .../testcases/cyclic_imports/index.ts | 9 + .../testcases/cyclic_imports/internal.ts | 21 ++ .../testcases/cyclic_imports/models.ts | 8 + .../{cycles => cyclic_types}/greetservice.ts | 2 +- .../generator/testcases/cyclic_types/index.ts | 9 + .../models.ts => cyclic_types/internal.ts} | 1 - .../testcases/cyclic_types/models.ts | 8 + .../generator/testcases/enum/greetservice.ts | 2 +- .../generator/testcases/enum/internal.ts | 29 +++ .../generator/testcases/enum/models.ts | 32 +-- .../services/internal.ts | 18 ++ .../services/models.ts | 19 +- .../greetservice.ts | 2 +- .../internal.ts | 14 ++ .../function_from_imported_package/models.ts | 15 +- .../services/internal.ts | 8 + .../services/models.ts | 9 +- .../services/otherservice.ts | 2 +- .../greetservice.ts | 2 +- .../internal.ts | 11 + .../models.ts | 12 +- .../services/other/internal.ts | 8 + .../services/other/models.ts | 9 +- .../services/other/otherservice.ts | 2 +- .../function_single_internal/greetservice.ts | 19 ++ .../function_single_internal/index.ts | 7 + .../testcases/no_bindings_here/internal.ts | 39 +++ .../testcases/no_bindings_here/models.ts | 40 +-- .../no_bindings_here/other/internal.ts | 17 ++ .../no_bindings_here/other/models.ts | 18 +- .../testcases/no_bindings_here/somemethods.ts | 4 +- .../testcases/out_of_tree/embedservice.ts | 2 +- .../greetservice.ts | 2 +- .../struct_literal_multiple_other/internal.ts | 11 + .../struct_literal_multiple_other/models.ts | 12 +- .../services/internal.ts | 8 + .../services/models.ts | 9 +- .../services/otherservice.ts | 2 +- .../greetservice.ts | 2 +- .../internal.ts | 8 + .../models.ts | 9 +- .../struct_literal_single/greetservice.ts | 2 +- .../struct_literal_single/internal.ts | 8 + .../testcases/struct_literal_single/models.ts | 9 +- .../greetservice.ts | 2 +- .../internal.ts | 15 ++ .../models.ts | 16 +- .../services/internal.ts | 8 + .../services/models.ts | 9 +- .../services/otherservice.ts | 2 +- v3/internal/generator/testdata/package.json | 3 +- v3/internal/generator/typedefs.go | 34 +++ v3/pkg/application/application_options.go | 5 - 517 files changed, 8972 insertions(+), 5966 deletions(-) create mode 100644 v3/examples/binding/assets/bindings/github.com/wailsapp/wails/v3/examples/binding/data/internal.js rename v3/internal/generator/render/templates/{models.js.tmpl => internal.js.tmpl} (94%) rename v3/internal/generator/render/templates/{models.ts.tmpl => internal.ts.tmpl} (93%) create mode 100644 v3/internal/generator/render/templates/models.tmpl rename v3/internal/generator/testcases/{cycles => cyclic_imports}/bound_types.json (100%) create mode 100644 v3/internal/generator/testcases/cyclic_imports/main.go create mode 100644 v3/internal/generator/testcases/cyclic_types/bound_types.json rename v3/internal/generator/testcases/{cycles => cyclic_types}/main.go (100%) create mode 100644 v3/internal/generator/testcases/function_single_internal/bound_types.json create mode 100644 v3/internal/generator/testcases/function_single_internal/main.go create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/internal.js create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/internal.js create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/greetservice.js rename v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/{cycles => cyclic_imports}/index.js (100%) create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/internal.js create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/models.js rename v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/{cycles => cyclic_types}/greetservice.js (98%) rename v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/{UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles => UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types}/index.js (100%) rename v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/{cycles/models.js => cyclic_types/internal.js} (100%) create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/models.js create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/internal.js create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/internal.js create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/internal.js create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/internal.js create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/internal.js create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/internal.js create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_internal/greetservice.js create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_internal/index.js create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/internal.js create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/internal.js create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/internal.js create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/internal.js create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/internal.js create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/internal.js create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/internal.js create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/internal.js create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/internal.js create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/greetservice.js rename v3/internal/generator/testdata/output/lang=JS/{UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles => UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports}/index.js (100%) create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/internal.js create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/models.js rename v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/{cycles => cyclic_types}/greetservice.js (98%) rename v3/internal/generator/testdata/output/lang=JS/{UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles => UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types}/index.js (100%) rename v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/{cycles/models.js => cyclic_types/internal.js} (100%) create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/models.js create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/internal.js create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/internal.js create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/internal.js create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/internal.js create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/internal.js create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/internal.js create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_internal/greetservice.js create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_internal/index.js create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/internal.js create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/internal.js create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/internal.js create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/internal.js create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/internal.js create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/internal.js create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/internal.js create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/internal.js create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/internal.js create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/greetservice.js create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/index.js create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/internal.js create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/models.js rename v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/{cycles => cyclic_types}/greetservice.js (94%) create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/index.js rename v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/{cycles/models.js => cyclic_types/internal.js} (69%) create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/models.js create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/internal.js create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/internal.js create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/internal.js create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/internal.js create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/internal.js create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/internal.js create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_internal/greetservice.js create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_internal/index.js create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/internal.js create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/internal.js create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/internal.js create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/internal.js create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/internal.js create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/internal.js create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/internal.js create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/internal.js create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/internal.js create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/greetservice.js create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/index.js create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/internal.js create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/models.js rename v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/{cycles => cyclic_types}/greetservice.js (94%) create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/index.js rename v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/{cycles/models.js => cyclic_types/internal.js} (69%) create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/models.js create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/internal.js create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/internal.js create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/internal.js create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/internal.js create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/internal.js create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/internal.js create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_internal/greetservice.js create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_internal/index.js create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/internal.js create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/internal.js create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/internal.js create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/internal.js create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/internal.js create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/internal.js create mode 100644 v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/internal.js create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/internal.ts create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/internal.ts create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/greetservice.ts rename v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/{cycles => cyclic_imports}/index.ts (100%) create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/internal.ts create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/models.ts rename v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/{cycles => cyclic_types}/greetservice.ts (98%) rename v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/{UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles => UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types}/index.ts (100%) rename v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/{cycles/models.ts => cyclic_types/internal.ts} (100%) create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/models.ts create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/internal.ts create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/internal.ts create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/internal.ts create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/internal.ts create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/internal.ts create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/internal.ts create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_internal/greetservice.ts create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_internal/index.ts create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/internal.ts create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/internal.ts create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/internal.ts create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/internal.ts create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/internal.ts create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/internal.ts create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/internal.ts create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/internal.ts create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/internal.ts create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/greetservice.ts rename v3/internal/generator/testdata/output/lang=TS/{UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles => UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports}/index.ts (100%) create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/internal.ts create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/models.ts rename v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/{cycles => cyclic_types}/greetservice.ts (98%) rename v3/internal/generator/testdata/output/lang=TS/{UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles => UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types}/index.ts (100%) rename v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/{cycles/models.ts => cyclic_types/internal.ts} (100%) create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/models.ts create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/internal.ts create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/internal.ts create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/internal.ts create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/internal.ts create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/internal.ts create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/internal.ts create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_internal/greetservice.ts create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_internal/index.ts create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/internal.ts create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/internal.ts create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/internal.ts create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/internal.ts create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/internal.ts create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/internal.ts create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/internal.ts create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/internal.ts create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/internal.ts create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/greetservice.ts create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/index.ts create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/internal.ts create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/models.ts rename v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/{cycles => cyclic_types}/greetservice.ts (93%) create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/index.ts rename v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/{cycles/models.ts => cyclic_types/internal.ts} (99%) create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/models.ts create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/internal.ts create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/internal.ts create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/internal.ts create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/internal.ts create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/internal.ts create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/internal.ts create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_internal/greetservice.ts create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_internal/index.ts create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/internal.ts create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/internal.ts create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/internal.ts create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/internal.ts create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/internal.ts create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/internal.ts create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/internal.ts create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/internal.ts create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/internal.ts create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/greetservice.ts create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/index.ts create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/internal.ts create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/models.ts rename v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/{cycles => cyclic_types}/greetservice.ts (94%) create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/index.ts rename v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/{cycles/models.ts => cyclic_types/internal.ts} (99%) create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/models.ts create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/internal.ts create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/internal.ts create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/internal.ts create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/internal.ts create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/internal.ts create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/internal.ts create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_internal/greetservice.ts create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_internal/index.ts create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/internal.ts create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/internal.ts create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/internal.ts create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/internal.ts create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/internal.ts create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/internal.ts create mode 100644 v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/internal.ts create mode 100644 v3/internal/generator/typedefs.go diff --git a/docs/src/content/docs/changelog.mdx b/docs/src/content/docs/changelog.mdx index a0aeed68d75..6ad587ab42d 100644 --- a/docs/src/content/docs/changelog.mdx +++ b/docs/src/content/docs/changelog.mdx @@ -26,9 +26,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### Breaking Changes + - Renamed Service methods: `Name` -> `ServiceName`, `OnStartup` -> `ServiceStartup`, `OnShutdown` -> `ServiceShutdown` by [@leaanthony](https://github.com/leaanthony) ### Added + - Support aarch64 AppImage builds by [@AkshayKalose](https://github.com/AkshayKalose) in [#3981](https://github.com/wailsapp/wails/pull/3981) - Add diagnostics section to `wails doctor` by [@leaanthony](https://github.com/leaanthony) - Add window to context when calling a service method by [@leaanthony](https://github.com/leaanthony) @@ -36,13 +38,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Better panic handling by [@leaanthony](https://github.com/leaanthony) ### Fixed + - Fixed Windows+Linux Edit Menu issues by [@leaanthony](https://github.com/leaanthony) in [#3f78a3a](https://github.com/wailsapp/wails/commit/3f78a3a8ce7837e8b32242c8edbbed431c68c062) - Updated the minimum system version in macOS .plist files from 10.13.0 to 10.15.0 by [@AkshayKalose](https://github.com/AkshayKalose) in [#3981](https://github.com/wailsapp/wails/pull/3981) - Window ID skip issue by [@leaanthony](https://github.com/leaanthony) - Fix nil menu issue when calling RegisterContextMenu by [@leaanthony](https://github.com/leaanthony) +- Fixed dependency cycles in binding generator output by [@fbbdev](https://github.com/fbbdev) in [#4001](https://github.com/wailsapp/wails/pull/4001) +- Fixed use-before-define errors in binding generator output by [@fbbdev](https://github.com/fbbdev) in [#4001](https://github.com/wailsapp/wails/pull/4001) ### Changed + - Removed `application.WindowIDKey` and `application.WindowNameKey` (replaced by `application.WindowKey`) by [@leaanthony](https://github.com/leaanthony) +- In JS/TS bindings, class fields of fixed-length array types are now initialized with their expected length instead of being empty by [@fbbdev](https://github.com/fbbdev) in [#4001](https://github.com/wailsapp/wails/pull/4001) ## v3.0.0-alpha.9 - 2025-01-13 diff --git a/v3/examples/binding/assets/bindings/github.com/wailsapp/wails/v3/examples/binding/data/internal.js b/v3/examples/binding/assets/bindings/github.com/wailsapp/wails/v3/examples/binding/data/internal.js new file mode 100644 index 00000000000..19a39472c46 --- /dev/null +++ b/v3/examples/binding/assets/bindings/github.com/wailsapp/wails/v3/examples/binding/data/internal.js @@ -0,0 +1,55 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Create as $Create} from "/wails/runtime.js"; + +/** + * Person holds someone's most important attributes + */ +export class Person { + /** + * Creates a new Person instance. + * @param {Partial} [$$source = {}] - The source object to create the Person. + */ + constructor($$source = {}) { + if (!("name" in $$source)) { + /** + * Name is the person's name + * @member + * @type {string} + */ + this["name"] = ""; + } + if (!("counts" in $$source)) { + /** + * Counts tracks the number of time the person + * has been greeted in various ways + * @member + * @type {number[]} + */ + this["counts"] = []; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + * @param {any} [$$source = {}] + * @returns {Person} + */ + static createFrom($$source = {}) { + const $$createField1_0 = $$createType0; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("counts" in $$parsedSource) { + $$parsedSource["counts"] = $$createField1_0($$parsedSource["counts"]); + } + return new Person(/** @type {Partial} */($$parsedSource)); + } +} + +// Private type creation functions +const $$createType0 = $Create.Array($Create.Any); diff --git a/v3/examples/binding/assets/bindings/github.com/wailsapp/wails/v3/examples/binding/data/models.js b/v3/examples/binding/assets/bindings/github.com/wailsapp/wails/v3/examples/binding/data/models.js index 19a39472c46..1cf2e24188a 100644 --- a/v3/examples/binding/assets/bindings/github.com/wailsapp/wails/v3/examples/binding/data/models.js +++ b/v3/examples/binding/assets/bindings/github.com/wailsapp/wails/v3/examples/binding/data/models.js @@ -2,54 +2,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import {Create as $Create} from "/wails/runtime.js"; - -/** - * Person holds someone's most important attributes - */ -export class Person { - /** - * Creates a new Person instance. - * @param {Partial} [$$source = {}] - The source object to create the Person. - */ - constructor($$source = {}) { - if (!("name" in $$source)) { - /** - * Name is the person's name - * @member - * @type {string} - */ - this["name"] = ""; - } - if (!("counts" in $$source)) { - /** - * Counts tracks the number of time the person - * has been greeted in various ways - * @member - * @type {number[]} - */ - this["counts"] = []; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new Person instance from a string or object. - * @param {any} [$$source = {}] - * @returns {Person} - */ - static createFrom($$source = {}) { - const $$createField1_0 = $$createType0; - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - if ("counts" in $$parsedSource) { - $$parsedSource["counts"] = $$createField1_0($$parsedSource["counts"]); - } - return new Person(/** @type {Partial} */($$parsedSource)); - } -} - -// Private type creation functions -const $$createType0 = $Create.Array($Create.Any); +export { + Person +} from "./internal.js"; diff --git a/v3/internal/generator/Taskfile.yaml b/v3/internal/generator/Taskfile.yaml index c4950ec50e5..f9e66e9396a 100644 --- a/v3/internal/generator/Taskfile.yaml +++ b/v3/internal/generator/Taskfile.yaml @@ -11,26 +11,26 @@ tasks: test: cmds: - - go test -v . + - go test -count=1 -v . - task: test:check test:analyse: cmds: - - go test -v -run ^TestAnalyser . + - go test -count=1 -v -run ^TestAnalyser . test:constants: cmds: - - go test -v -run ^TestGenerateConstants . + - go test -v -count=1 -run ^TestGenerateConstants . test:generate: cmds: - - go test -v -run ^TestGenerator . + - go test -v -count=1 -run ^TestGenerator . - task: test:check test:regenerate: cmds: - cmd: rm -rf ./testdata/output/* - - cmd: go test -v -run ^TestGenerator . + - cmd: go test -v -count=1 -run ^TestGenerator . ignore_error: true - task: test:generate @@ -40,6 +40,7 @@ tasks: - install-deps cmds: - npx tsc + - npx madge --circular output/ install-deps: internal: true diff --git a/v3/internal/generator/analyse.go b/v3/internal/generator/analyse.go index 6aca7b899ff..7fa614e0e5d 100644 --- a/v3/internal/generator/analyse.go +++ b/v3/internal/generator/analyse.go @@ -4,6 +4,7 @@ import ( "fmt" "go/token" "go/types" + "iter" "github.com/wailsapp/wails/v3/internal/generator/config" "golang.org/x/tools/go/packages" @@ -19,7 +20,7 @@ import ( // Results are deduplicated, i.e. yield is called at most once per object. // // If yield returns false, FindBoundTypes returns immediately. -func FindServices(pkgs []*packages.Package, systemPaths *config.SystemPaths, logger config.Logger, yield func(*types.TypeName) bool) error { +func FindServices(pkgs []*packages.Package, systemPaths *config.SystemPaths, logger config.Logger) (iter.Seq[*types.TypeName], error) { type instanceInfo struct { args *types.TypeList pos token.Position @@ -122,7 +123,7 @@ func FindServices(pkgs []*packages.Package, systemPaths *config.SystemPaths, log signature := fn.Type().(*types.Signature) if signature.Params().Len() > 2 || signature.Results().Len() != 1 || tp.Len() != 1 || tp.At(0).Obj() == nil { logger.Warningf("Param Len: %d, Results Len: %d, tp.Len: %d, tp.At(0).Obj(): %v", signature.Params().Len(), signature.Results().Len(), tp.Len(), tp.At(0).Obj()) - return ErrBadApplicationPackage + return nil, ErrBadApplicationPackage } // Schedule unique type param for analysis. @@ -136,71 +137,71 @@ func FindServices(pkgs []*packages.Package, systemPaths *config.SystemPaths, log // found tracks service types that have been found so far, for deduplication. found := make(map[*types.TypeName]bool) - // Process targets. - for len(next) > 0 { - // Pop one target off the next list. - tgt := next[len(next)-1] - next = next[:len(next)-1] - - // Prepare indirect binding message. - indirectMsg := "" - if tgt.cause.IsValid() { - indirectMsg = fmt.Sprintf(" (indirectly bound at %s)", tgt.cause) - } - - for _, instance := range instances[tgt.obj] { - // Retrieve type argument. - serviceType := types.Unalias(instance.args.At(tgt.param)) + return func(yield func(*types.TypeName) bool) { + // Process targets. + for len(next) > 0 { + // Pop one target off the next list. + tgt := next[len(next)-1] + next = next[:len(next)-1] + + // Prepare indirect binding message. + indirectMsg := "" + if tgt.cause.IsValid() { + indirectMsg = fmt.Sprintf(" (indirectly bound at %s)", tgt.cause) + } - var named *types.Named + for _, instance := range instances[tgt.obj] { + // Retrieve type argument. + serviceType := types.Unalias(instance.args.At(tgt.param)) + + var named *types.Named + + switch t := serviceType.(type) { + case *types.Named: + // Process named type. + named = t.Origin() + + case *types.TypeParam: + // Schedule type parameter for analysis. + newtgt := target{owner[t.Obj()], t.Index()} + if !scheduled[newtgt] { + scheduled[newtgt] = true + + // Retrieve position of call to application.NewService + // that caused this target to be scheduled. + cause := tgt.cause + if !tgt.cause.IsValid() { + // This _is_ a call to application.NewService. + cause = instance.pos + } - switch t := serviceType.(type) { - case *types.Named: - // Process named type. - named = t.Origin() - - case *types.TypeParam: - // Schedule type parameter for analysis. - newtgt := target{owner[t.Obj()], t.Index()} - if !scheduled[newtgt] { - scheduled[newtgt] = true - - // Retrieve position of call to application.NewService - // that caused this target to be scheduled. - cause := tgt.cause - if !tgt.cause.IsValid() { - // This _is_ a call to application.NewService. - cause = instance.pos + // Push on next list. + next = append(next, targetInfo{newtgt, cause}) } + continue - // Push on next list. - next = append(next, targetInfo{newtgt, cause}) + default: + logger.Warningf("%s: ignoring anonymous service type %s%s", instance.pos, serviceType, indirectMsg) + continue } - continue - - default: - logger.Warningf("%s: ignoring anonymous service type %s%s", instance.pos, serviceType, indirectMsg) - continue - } - // Reject interfaces and generic types. - if types.IsInterface(named.Underlying()) { - logger.Warningf("%s: ignoring interface service type %s%s", instance.pos, named, indirectMsg) - continue - } else if named.TypeParams() != nil { - logger.Warningf("%s: ignoring generic service type %s", instance.pos, named, indirectMsg) - continue - } + // Reject interfaces and generic types. + if types.IsInterface(named.Underlying()) { + logger.Warningf("%s: ignoring interface service type %s%s", instance.pos, named, indirectMsg) + continue + } else if named.TypeParams() != nil { + logger.Warningf("%s: ignoring generic service type %s", instance.pos, named, indirectMsg) + continue + } - // Record and yield type object. - if !found[named.Obj()] { - found[named.Obj()] = true - if !yield(named.Obj()) { - return nil + // Record and yield type object. + if !found[named.Obj()] { + found[named.Obj()] = true + if !yield(named.Obj()) { + return + } } } } - } - - return nil + }, nil } diff --git a/v3/internal/generator/analyse_test.go b/v3/internal/generator/analyse_test.go index 1e659a86f40..576e56f6f31 100644 --- a/v3/internal/generator/analyse_test.go +++ b/v3/internal/generator/analyse_test.go @@ -97,14 +97,15 @@ func TestAnalyser(t *testing.T) { got := make([]string, 0) - err = FindServices(pkgs, systemPaths, config.DefaultPtermLogger(nil), func(tn *types.TypeName) bool { - got = append(got, types.TypeString(tn.Type(), nil)) - return true - }) + services, err := FindServices(pkgs, systemPaths, config.DefaultPtermLogger(nil)) if err != nil { t.Error(err) } + for obj := range services { + got = append(got, types.TypeString(obj.Type(), nil)) + } + slices.Sort(got) if diff := cmp.Diff(test.want, got); diff != "" { diff --git a/v3/internal/generator/collect/imports.go b/v3/internal/generator/collect/imports.go index 0c5f445d1d7..e2346dc50a5 100644 --- a/v3/internal/generator/collect/imports.go +++ b/v3/internal/generator/collect/imports.go @@ -15,8 +15,6 @@ type ( // ImportModels records whether models from the current package may be needed. ImportModels bool - // ImportInternal records whether internal models from the current package may be needed. - ImportInternal bool // External records information about each imported package, // keyed by package path. @@ -68,9 +66,6 @@ func (imports *ImportMap) Merge(other *ImportMap) { if other.ImportModels { imports.ImportModels = true } - if other.ImportInternal { - imports.ImportInternal = true - } for path, info := range other.External { if _, ok := imports.External[path]; ok { @@ -151,12 +146,7 @@ func (imports *ImportMap) addTypeImpl(typ types.Type, visited map[*types.TypeNam } if obj.Pkg().Path() == imports.Self { - // Record self import. - if obj.Exported() { - imports.ImportModels = true - } else { - imports.ImportInternal = true - } + imports.ImportModels = true } // Record model. diff --git a/v3/internal/generator/collect/index.go b/v3/internal/generator/collect/index.go index 05c65c1502f..e34e018d7be 100644 --- a/v3/internal/generator/collect/index.go +++ b/v3/internal/generator/collect/index.go @@ -5,24 +5,30 @@ import ( "strings" ) -// PackageIndex lists all bindings, models and unexported models -// generated from a package. +// PackageIndex lists all services, models and unexported models +// to be generated from a single package. // // When obtained through a call to [PackageInfo.Index], -// each binding and model name appears at most once. +// each service and model appears at most once; +// services are sorted by name; +// exported models precede all unexported ones +// and both ranges are sorted by name. type PackageIndex struct { Package *PackageInfo Services []*ServiceInfo - Models []*ModelInfo - Internal []*ModelInfo + + Models []*ModelInfo + HasExportedModels bool // If true, there is at least one exported model. } // Index computes a [PackageIndex] for the selected language from the list // of generated services and models and regenerates cached stats. // -// Services and models appear at most once in the returned slices, -// which are sorted by name. +// Services and models appear at most once in the returned slices; +// services are sorted by name; +// exported models precede all unexported ones +// and both ranges are sorted by name. // // Index calls info.Collect, and therefore provides the same guarantees. // It is safe for concurrent use. @@ -38,7 +44,7 @@ func (info *PackageInfo) Index(TS bool) (index *PackageIndex) { } // Gather services. - info.services.Range(func(key, value any) bool { + for _, value := range info.services.Range { service := value.(*ServiceInfo) if !service.IsEmpty() { if service.Object().Exported() { @@ -49,8 +55,7 @@ func (info *PackageInfo) Index(TS bool) (index *PackageIndex) { stats.NumServices++ stats.NumMethods += len(service.Methods) } - return true - }) + } // Sort services by name. slices.SortFunc(index.Services, func(b1 *ServiceInfo, b2 *ServiceInfo) int { @@ -61,19 +66,22 @@ func (info *PackageInfo) Index(TS bool) (index *PackageIndex) { }) // Gather models. - info.models.Range(func(key, value any) bool { + for _, value := range info.models.Range { model := value.(*ModelInfo) index.Models = append(index.Models, model) + // Mark presence of exported models + if model.Object().Exported() { + index.HasExportedModels = true + } // Update model stats. if len(model.Values) > 0 { stats.NumEnums++ } else { stats.NumModels++ } - return true - }) + } - // Sort models by internal property (non-internal first), then by name. + // Sort models by exported property (exported first), then by name. slices.SortFunc(index.Models, func(m1 *ModelInfo, m2 *ModelInfo) int { if m1 == m2 { return 0 @@ -91,19 +99,6 @@ func (info *PackageInfo) Index(TS bool) (index *PackageIndex) { return strings.Compare(m1.Name, m2.Name) }) - // Find first internal model. - split, _ := slices.BinarySearchFunc(index.Models, struct{}{}, func(m *ModelInfo, _ struct{}) int { - if m.Object().Exported() { - return -1 - } else { - return 1 - } - }) - - // Separate internal and non-internal models. - index.Internal = index.Models[split:] - index.Models = index.Models[:split] - // Cache stats info.stats.Store(stats) diff --git a/v3/internal/generator/collect/properties.go b/v3/internal/generator/collect/properties.go index 194d06dff5f..44513c9ec9a 100644 --- a/v3/internal/generator/collect/properties.go +++ b/v3/internal/generator/collect/properties.go @@ -117,11 +117,11 @@ func IsClass(typ types.Type) bool { typ = types.Unalias(typ) if _, isNamed := typ.(*types.Named); !isNamed { - // Not a model type. + // Unnamed types are never rendered as classes. return false } - // Struct types without custom marshaling are rendered as classes. + // Struct named types without custom marshaling are rendered as classes. _, isStruct := typ.Underlying().(*types.Struct) return isStruct && !MaybeJSONMarshaler(typ) && !MaybeTextMarshaler(typ) } diff --git a/v3/internal/generator/collect/service.go b/v3/internal/generator/collect/service.go index a811e10f22f..17843611133 100644 --- a/v3/internal/generator/collect/service.go +++ b/v3/internal/generator/collect/service.go @@ -54,23 +54,6 @@ type ( } ) -func isInternalServiceMethod(method *types.Func) bool { - internalServiceMethods := []string{ - "ServiceName", - "ServiceStartup", - "ServiceShutdown", - "ServeHTTP", - } - methodName := method.Name() - for _, name := range internalServiceMethods { - if name == methodName { - return true - } - } - - return false -} - func newServiceInfo(collector *Collector, obj *types.TypeName) *ServiceInfo { return &ServiceInfo{ TypeInfo: collector.Type(obj), @@ -136,8 +119,8 @@ func (info *ServiceInfo) Collect() *ServiceInfo { // Collect method information. info.Methods = make([]*ServiceMethodInfo, 0, len(mset)) for _, sel := range mset { - if !sel.Obj().Exported() { - // Ignore unexported methods. + if !sel.Obj().Exported() || internalServiceMethods[sel.Obj().Name()] { + // Ignore unexported and internal methods. continue } @@ -179,6 +162,16 @@ func (info *ServiceInfo) Collect() *ServiceInfo { return info } +// internalServiceMethod is a set of methods +// that are handled specially by the binding engine +// and must not be exposed to the frontend. +var internalServiceMethods = map[string]bool{ + "ServiceName": true, + "ServiceStartup": true, + "ServiceShutdown": true, + "ServeHTTP": true, +} + // typeError caches the type-checker type for the Go error interface. var typeError = types.Universe.Lookup("error").Type() @@ -188,10 +181,6 @@ var typeAny = types.Universe.Lookup("any").Type().Underlying() // collectMethod collects and returns information about a service method. // It is intended to be called only by ServiceInfo.Collect. func (info *ServiceInfo) collectMethod(method *types.Func) *ServiceMethodInfo { - if isInternalServiceMethod(method) { - // Ignore internal methods. - return nil - } collector := info.collector obj := info.Object().(*types.TypeName) @@ -258,8 +247,6 @@ func (info *ServiceInfo) collectMethod(method *types.Func) *ServiceMethodInfo { } } - var needsContext bool - // Collect parameters. for i := range signature.Params().Len() { param := signature.Params().At(i) @@ -268,16 +255,6 @@ func (info *ServiceInfo) collectMethod(method *types.Func) *ServiceMethodInfo { // Skip first parameter if it has context type. named, ok := types.Unalias(param.Type()).(*types.Named) if ok && named.Obj().Pkg().Path() == collector.systemPaths.ContextPackage && named.Obj().Name() == "Context" { - needsContext = true - continue - } - } - - if i == 0 || (i == 1 && needsContext) { - // Skip first parameter if it has window type, - // or second parameter if it has window type and first is context. - named, ok := types.Unalias(param.Type()).(*types.Named) - if ok && named.Obj().Pkg().Path() == collector.systemPaths.ApplicationPackage && named.Obj().Name() == "Window" { continue } } diff --git a/v3/internal/generator/errors.go b/v3/internal/generator/errors.go index 966d698f2f1..d5b8acfd60a 100644 --- a/v3/internal/generator/errors.go +++ b/v3/internal/generator/errors.go @@ -3,9 +3,10 @@ package generator import ( "errors" "fmt" + "maps" + "slices" "sync" - "github.com/samber/lo" "github.com/wailsapp/wails/v3/internal/generator/config" ) @@ -118,7 +119,7 @@ func (report *ErrorReport) Errors() []string { report.mu.Lock() defer report.mu.Unlock() - return lo.Keys(report.errors) + return slices.Collect(maps.Keys(report.errors)) } // Warnings returns the list of warning messages @@ -128,7 +129,7 @@ func (report *ErrorReport) Warnings() []string { report.mu.Lock() defer report.mu.Unlock() - return lo.Keys(report.warnings) + return slices.Collect(maps.Keys(report.warnings)) } // Errorf formats an error message and adds it to the report. diff --git a/v3/internal/generator/generate.go b/v3/internal/generator/generate.go index 44efe3d6da4..7a8c38cf21c 100644 --- a/v3/internal/generator/generate.go +++ b/v3/internal/generator/generate.go @@ -2,10 +2,7 @@ package generator import ( "fmt" - "go/types" "io" - "os" - "slices" "strings" "sync" "time" @@ -80,16 +77,6 @@ func (generator *Generator) Generate(patterns ...string) (stats *collect.Stats, stats.Start() defer stats.Stop() - // Enable type aliases. - // This should become unnecessary from Go 1.23 onwards. - goDebug := os.Getenv("GODEBUG") - defer os.Setenv("GODEBUG", goDebug) - settings := slices.DeleteFunc(strings.Split(goDebug, ","), func(setting string) bool { - return strings.HasPrefix(setting, "gotypesalias=") - }) - settings = append(settings, "gotypesalias=1") - os.Setenv("GODEBUG", strings.Join(settings, ",")) - // Validate file names. err = generator.validateFileNames() if err != nil { @@ -153,26 +140,28 @@ func (generator *Generator) Generate(patterns ...string) (stats *collect.Stats, generator.logger.Statusf("Looking for services...") serviceFound := sync.OnceFunc(func() { generator.logger.Statusf("Generating service bindings...") }) - // Run static analysis and schedule service code generation for each result. - err = FindServices(pkgs, systemPaths, generator.logger, func(obj *types.TypeName) bool { + // Run static analysis. + services, err := FindServices(pkgs, systemPaths, generator.logger) + + // Check for analyser errors. + if err != nil { + return + } + + // Discard unneeded data. + pkgs = nil + + // Schedule code generation for each found service. + for obj := range services { serviceFound() generator.scheduler.Schedule(func() { generator.generateService(obj) }) - return true - }) - - // Discard unneeded data. - pkgs = nil + } // Wait until all services have been generated and all models collected. generator.scheduler.Wait() - // Check for analyser errors. - if err != nil { - return - } - // Invariants: // - Service files have been generated for all discovered services; // - ModelInfo.Collect has been called on all discovered models, and therefore @@ -186,22 +175,20 @@ func (generator *Generator) Generate(patterns ...string) (stats *collect.Stats, } // Schedule models, index and included files generation for each package. - generator.collector.Iterate(func(info *collect.PackageInfo) bool { + for info := range generator.collector.Iterate { generator.scheduler.Schedule(func() { generator.generateModelsIndexIncludes(info) }) - return true - }) + } // Wait until all models and indices have been generated. generator.scheduler.Wait() // Populate stats. generator.logger.Statusf("Collecting stats...") - generator.collector.Iterate(func(info *collect.PackageInfo) bool { + for info := range generator.collector.Iterate { stats.Add(info.Stats()) - return true - }) + } // Return non-empty error report. if generator.logger.HasErrors() || generator.logger.HasWarnings() { @@ -222,13 +209,13 @@ func (generator *Generator) generateModelsIndexIncludes(info *collect.PackageInf if len(index.Models) > 0 { generator.scheduler.Schedule(func() { - generator.generateModels(info, index.Models, false) + generator.generateTypedefs(info, index.Models) }) } - if len(index.Internal) > 0 { + if index.HasExportedModels { generator.scheduler.Schedule(func() { - generator.generateModels(info, index.Internal, true) + generator.generateModels(index) }) } diff --git a/v3/internal/generator/includes.go b/v3/internal/generator/includes.go index b9b2ab7e9d5..9884c74b2d0 100644 --- a/v3/internal/generator/includes.go +++ b/v3/internal/generator/includes.go @@ -17,7 +17,7 @@ func (generator *Generator) generateIncludes(index *collect.PackageIndex) { // Validate filename. switch name { case generator.renderer.ModelsFile(): - if len(index.Models) > 0 { + if index.HasExportedModels { generator.logger.Errorf( "package %s: included file '%s' collides with models filename; please rename the file or choose a different filename for models", index.Package.Path, @@ -27,7 +27,7 @@ func (generator *Generator) generateIncludes(index *collect.PackageIndex) { } case generator.renderer.InternalFile(): - if len(index.Internal) > 0 { + if len(index.Models) > 0 { generator.logger.Errorf( "package %s: included file '%s' collides with internal models filename; please rename the file or choose a different filename for internal models", index.Package.Path, diff --git a/v3/internal/generator/models.go b/v3/internal/generator/models.go index 9532593eccf..0060b254ce5 100644 --- a/v3/internal/generator/models.go +++ b/v3/internal/generator/models.go @@ -6,55 +6,19 @@ import ( "github.com/wailsapp/wails/v3/internal/generator/collect" ) -// generateModels generates a JS/TS model file for the given list of models. -// -// If internal is true, the generated file is named by Renderer.InternalFile -// and the types declared therein are not exported by the package index file. -// -// A call to info.Collect must complete before entering generateModels. -func (generator *Generator) generateModels(info *collect.PackageInfo, models []*collect.ModelInfo, internal bool) { - // Merge all import maps. - imports := collect.NewImportMap(info) - for _, model := range models { - imports.Merge(model.Imports) - } - - // Clear irrelevant imports. - if internal { - imports.ImportInternal = false - } else { - imports.ImportModels = false - } - - // Retrieve appropriate file name. - var filename string - if internal { - filename = generator.renderer.InternalFile() - } else { - filename = generator.renderer.ModelsFile() - } - - file, err := generator.creator.Create(filepath.Join(info.Path, filename)) +// generateModels generates a file for exported models from the given index information. +func (generator *Generator) generateModels(index *collect.PackageIndex) { + file, err := generator.creator.Create(filepath.Join(index.Package.Path, generator.renderer.ModelsFile())) if err != nil { generator.logger.Errorf("%v", err) - - var prefix string - if internal { - prefix = "internal " - } - generator.logger.Errorf("package %s: %smodels generation failed", info.Path, prefix) + generator.logger.Errorf("package %s: exported models generation failed", index.Package.Path) return } defer file.Close() - err = generator.renderer.Models(file, imports, models) + err = generator.renderer.Models(file, index) if err != nil { generator.logger.Errorf("%v", err) - - var prefix string - if internal { - prefix = "internal " - } - generator.logger.Errorf("package %s: %smodels generation failed", info.Path, prefix) + generator.logger.Errorf("package %s: exported models generation failed", index.Package.Path) } } diff --git a/v3/internal/generator/render/create.go b/v3/internal/generator/render/create.go index b7b83383c16..9ab8098696a 100644 --- a/v3/internal/generator/render/create.go +++ b/v3/internal/generator/render/create.go @@ -221,7 +221,7 @@ func (m *module) PostponedCreates() []string { case *types.Named: if !collect.IsClass(key) { - // Creation function for non-struct named types + // Creation functions for non-struct named types // require an indirect assignment to break cycles. // Typescript cannot infer the return type on its own: add hints. @@ -254,10 +254,8 @@ func (m *module) PostponedCreates() []string { builder.WriteString(pre) if t.Obj().Pkg().Path() == m.Imports.Self { - if t.Obj().Exported() && m.Imports.ImportModels { + if m.Imports.ImportModels { builder.WriteString("$models.") - } else if !t.Obj().Exported() && m.Imports.ImportInternal { - builder.WriteString("$internal.") } } else { builder.WriteString(jsimport(m.Imports.External[t.Obj().Pkg().Path()])) diff --git a/v3/internal/generator/render/default.go b/v3/internal/generator/render/default.go index a30b3cd9575..1c045a2ff26 100644 --- a/v3/internal/generator/render/default.go +++ b/v3/internal/generator/render/default.go @@ -23,7 +23,15 @@ func (m *module) JSDefault(typ types.Type, quoted bool) (result string) { return result } - case *types.Array, *types.Slice: + case *types.Array: + if t.Len() == 0 { + return "[]" + } else { + // Initialise array with expected number of elements + return fmt.Sprintf("Array.from({ length: %d }, () => %s)", t.Len(), m.JSDefault(t.Elem(), false)) + } + + case *types.Slice: if types.Identical(typ, typeByteSlice) { return `""` } else { @@ -105,10 +113,8 @@ func (m *module) renderNamedDefault(typ aliasOrNamed, quoted bool) (result strin } prefix := "" - if typ.Obj().Exported() && m.Imports.ImportModels { + if m.Imports.ImportModels { prefix = "$models." - } else if !typ.Obj().Exported() && m.Imports.ImportInternal { - prefix = "$internal." } if collect.IsAny(typ) { diff --git a/v3/internal/generator/render/renderer.go b/v3/internal/generator/render/renderer.go index 2ebf248852c..e1108716e66 100644 --- a/v3/internal/generator/render/renderer.go +++ b/v3/internal/generator/render/renderer.go @@ -1,7 +1,9 @@ package render import ( + "go/types" "io" + "slices" "strings" "text/template" @@ -17,8 +19,8 @@ type Renderer struct { ext string - service *template.Template - models *template.Template + service *template.Template + typedefs *template.Template } // NewRenderer initialises a code renderer @@ -35,8 +37,8 @@ func NewRenderer(options *flags.GenerateBindingsOptions, collector *collect.Coll ext: ext, - service: tmplService[tmplLanguage(options.TS)], - models: tmplModels[tmplLanguage(options.TS)], + service: tmplService[tmplLanguage(options.TS)], + typedefs: tmplTypedefs[tmplLanguage(options.TS)], } } @@ -79,9 +81,46 @@ func (renderer *Renderer) Service(w io.Writer, info *collect.ServiceInfo) error }) } -// Models renders models code for the given list of models. -func (renderer *Renderer) Models(w io.Writer, imports *collect.ImportMap, models []*collect.ModelInfo) error { - return renderer.models.Execute(w, &struct { +// Typedefs renders type definitions for the given list of models. +func (renderer *Renderer) Typedefs(w io.Writer, imports *collect.ImportMap, models []*collect.ModelInfo) error { + if !renderer.options.UseInterfaces { + // Sort class aliases after the class they alias. + // Works in amortized linear time thanks to an auxiliary map. + + // Track postponed class aliases and their dependencies. + aliases := make(map[types.Object][]*collect.ModelInfo, len(models)) + + models = slices.Clone(models) + for i, j := 0, 0; i < len(models); i++ { + if models[i].Type != nil && collect.IsClass(models[i].Type) { + // models[i] is a class alias: + // models[i].Type is guaranteed to be + // either an alias or a named type + obj := models[i].Type.(interface{ Obj() *types.TypeName }).Obj() + if obj.Pkg().Path() == imports.Self { + // models[i] aliases a type from the current module. + if a, ok := aliases[obj]; !ok || len(a) > 0 { + // The aliased type has not been visited already, postpone. + aliases[obj] = append(a, models[i]) + continue + } + } + } + + // Append models[i]. + models[j] = models[i] + j++ + + // Keep appending aliases whose aliased type has been just appended. + for k := j - 1; k < j; k++ { + a := aliases[models[k].Object()] + aliases[models[k].Object()] = nil // Mark aliased model as visited + j += copy(models[j:], a) + } + } + } + + return renderer.typedefs.Execute(w, &struct { module Models []*collect.ModelInfo }{ @@ -94,6 +133,19 @@ func (renderer *Renderer) Models(w io.Writer, imports *collect.ImportMap, models }) } +// Models renders exported models for the given package index to w. +func (renderer *Renderer) Models(w io.Writer, index *collect.PackageIndex) error { + return tmplModels.Execute(w, &struct { + *collect.PackageIndex + *Renderer + *flags.GenerateBindingsOptions + }{ + index, + renderer, + renderer.options, + }) +} + // Index renders the given package index to w. func (renderer *Renderer) Index(w io.Writer, index *collect.PackageIndex) error { return tmplIndex.Execute(w, &struct { diff --git a/v3/internal/generator/render/templates.go b/v3/internal/generator/render/templates.go index 13ff40f60b7..e3f7dbe17ed 100644 --- a/v3/internal/generator/render/templates.go +++ b/v3/internal/generator/render/templates.go @@ -18,11 +18,13 @@ var tmplService = map[tmplLanguage]*template.Template{ tmplTS: template.Must(template.New("service.ts.tmpl").Funcs(tmplFunctions).ParseFS(templates, "templates/service.ts.tmpl")), } -var tmplModels = map[tmplLanguage]*template.Template{ - tmplJS: template.Must(template.New("models.js.tmpl").Funcs(tmplFunctions).ParseFS(templates, "templates/models.js.tmpl")), - tmplTS: template.Must(template.New("models.ts.tmpl").Funcs(tmplFunctions).ParseFS(templates, "templates/models.ts.tmpl")), +var tmplTypedefs = map[tmplLanguage]*template.Template{ + tmplJS: template.Must(template.New("internal.js.tmpl").Funcs(tmplFunctions).ParseFS(templates, "templates/internal.js.tmpl")), + tmplTS: template.Must(template.New("internal.ts.tmpl").Funcs(tmplFunctions).ParseFS(templates, "templates/internal.ts.tmpl")), } +var tmplModels = template.Must(template.New("models.tmpl").Funcs(tmplFunctions).ParseFS(templates, "templates/models.tmpl")) + var tmplIndex = template.Must(template.New("index.tmpl").Funcs(tmplFunctions).ParseFS(templates, "templates/index.tmpl")) var newline string diff --git a/v3/internal/generator/render/templates/index.tmpl b/v3/internal/generator/render/templates/index.tmpl index 369c1e939b0..80230aaf2e6 100644 --- a/v3/internal/generator/render/templates/index.tmpl +++ b/v3/internal/generator/render/templates/index.tmpl @@ -28,7 +28,7 @@ export { {{- end}} }; {{end}} -{{- if .Models}} +{{- if .HasExportedModels}} export * from "./{{js $models}}"; {{end}} {{- range .Package.Injections}} diff --git a/v3/internal/generator/render/templates/models.js.tmpl b/v3/internal/generator/render/templates/internal.js.tmpl similarity index 94% rename from v3/internal/generator/render/templates/models.js.tmpl rename to v3/internal/generator/render/templates/internal.js.tmpl index af58096a7f6..f954d9f6342 100644 --- a/v3/internal/generator/render/templates/models.js.tmpl +++ b/v3/internal/generator/render/templates/internal.js.tmpl @@ -1,7 +1,6 @@ {{$module := .}} {{- $runtime := $module.Runtime}} {{- $models := (fixext $module.ModelsFile)}} -{{- $internal := (fixext $module.InternalFile)}} {{- $useInterfaces := .UseInterfaces}} {{- $imports := $module.Imports -}} // @ts-check @@ -11,23 +10,13 @@ // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports import {Create as $Create} from "{{js $runtime}}"; -{{- end}} +{{end -}} {{range $imports.External}} // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports import * as {{jsimport .}} from "{{js .RelPath}}/{{js $models}}"; {{- end}}{{if $imports.External}} {{end}} -{{- if or $useInterfaces $imports.ImportModels}} -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as $models from "./{{js $models}}";{{if not $imports.ImportInternal}} -{{end}}{{end}} -{{- if $imports.ImportInternal}} -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as $internal from "./{{js $internal}}"; -{{end}} {{- range $model := .Models}} {{- $isEnum := $model.Values}} @@ -218,4 +207,9 @@ export class {{jsid $model.Name}} { {{if and (ge (len $create) 54) (eq (slice $create 39 54) "function $$init")}}var {{else}}const {{end -}} $$createType{{$i}} = {{$create}}; {{- end}} +{{end}} +{{- if $useInterfaces}} +// In interface mode, this file is likely to contain just comments. +// We add a dummy export statement to ensure it is recognised as an ES module. +export {}; {{end -}} diff --git a/v3/internal/generator/render/templates/models.ts.tmpl b/v3/internal/generator/render/templates/internal.ts.tmpl similarity index 93% rename from v3/internal/generator/render/templates/models.ts.tmpl rename to v3/internal/generator/render/templates/internal.ts.tmpl index aa798c11a22..383623c3e0d 100644 --- a/v3/internal/generator/render/templates/models.ts.tmpl +++ b/v3/internal/generator/render/templates/internal.ts.tmpl @@ -1,7 +1,6 @@ {{$module := .}} {{- $runtime := $module.Runtime}} {{- $models := (fixext $module.ModelsFile)}} -{{- $internal := (fixext $module.InternalFile)}} {{- $useInterfaces := .UseInterfaces}} {{- $imports := $module.Imports -}} // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL @@ -10,23 +9,13 @@ // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports import {Create as $Create} from "{{js $runtime}}"; -{{- end}} +{{end -}} {{range $imports.External}} // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports import * as {{jsimport .}} from "{{js .RelPath}}/{{js $models}}"; {{- end}}{{if $imports.External}} {{end}} -{{- if $imports.ImportModels}} -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as $models from "./{{js $models}}";{{if not $imports.ImportInternal}} -{{end}}{{end}} -{{- if $imports.ImportInternal}} -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as $internal from "./{{js $internal}}"; -{{end}} {{- range $model := .Models}} {{- $isEnum := $model.Values}} diff --git a/v3/internal/generator/render/templates/models.tmpl b/v3/internal/generator/render/templates/models.tmpl new file mode 100644 index 00000000000..24622685bf1 --- /dev/null +++ b/v3/internal/generator/render/templates/models.tmpl @@ -0,0 +1,94 @@ +{{$renderer := .}} +{{- $useInterfaces := .UseInterfaces}} +{{- $internal := (fixext .InternalFile)}} +{{- if not .TS -}} +// @ts-check +{{end -}} +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +{{- $hasObjects := false}} +{{- $hasTypes := false}} + +{{- range $model := .Models}} +{{- if not $model.Object.Exported}}{{break}}{{end}} + +{{- $isEnum := $model.Values}} +{{- $isClassAlias := and $model.Type (not $useInterfaces) (isclass $model.Type)}} +{{- $isClass := and (not $model.Type) (not $model.Values) (not $useInterfaces) (not $model.Alias)}} + +{{- if or $isEnum $isClassAlias $isClass}} +{{- if not $hasObjects}} + {{- $hasObjects = true}} + +export { +{{- else}},{{end}} + {{jsid $model.Name}} +{{- else}} + {{- $hasTypes = true}} +{{- end}} +{{- end}} +{{- if $hasObjects}} +} from "./{{js $internal}}"; +{{- end}} + +{{- if $hasTypes}} +{{- $hasTypes = false}} + +{{if .TS -}} +export type { +{{- else -}} +import * as $models from "./{{js $internal}}"; +{{- end}} +{{- range $model := .Models}} +{{- if not $model.Object.Exported}}{{break}}{{end}} + +{{- $isEnum := $model.Values}} +{{- $isClassAlias := and $model.Type (not $useInterfaces) (isclass $model.Type)}} +{{- $isClass := and (not $model.Type) (not $model.Values) (not $useInterfaces) (not $model.Alias)}} +{{- if or $isEnum $isClassAlias $isClass}}{{continue}}{{end}} + +{{- /* Build type parameter list */}} +{{- $typeParams := ""}} +{{- $typeParamList := ""}} +{{- range $i, $param := $model.TypeParams}} + {{- $param = (typeparam $i $param)}} + {{- if eq $i 0}} + {{- $typeParams = $param}} + {{- $typeParamList = (printf "<%s" $param)}} + {{- else}} + {{- $typeParams = (printf "%s,%s" $typeParams $param)}} + {{- $typeParamList = (printf "%s, %s" $typeParamList $param)}} + {{- end}} +{{- end}} +{{- if $typeParamList}} + {{- $typeParamList = (printf "%s>" $typeParamList)}} +{{- end}} +{{- if $renderer.TS}} + {{- if $hasTypes}},{{end}} + {{jsid $model.Name}} +{{- else}} + +/** +{{- if hasdoc $model.Decl.Doc}} +{{- jsdoc $model.Decl.Doc.Text ""}}{{if hasdoc $model.Doc}} + *{{end}} +{{- end}} +{{- if hasdoc $model.Doc}} +{{- jsdoc $model.Doc.Text ""}} +{{- end}} +{{- if $typeParamList}} + * @template {{$typeParams}} +{{- end}} + * @typedef {$models.{{jsid $model.Name}}{{$typeParamList -}} } {{jsid $model.Name}} + */ +{{- end}} + +{{- $hasTypes = true}} +{{- end}} + +{{- if .TS}} +} from "./{{js $internal}}"; +{{- end}} + +{{- end}} diff --git a/v3/internal/generator/render/templates/service.js.tmpl b/v3/internal/generator/render/templates/service.js.tmpl index b4200dc46b2..d477cbc62f3 100644 --- a/v3/internal/generator/render/templates/service.js.tmpl +++ b/v3/internal/generator/render/templates/service.js.tmpl @@ -33,12 +33,7 @@ import * as {{jsimport .}} from "{{js .RelPath}}/{{js $models}}"; {{- if $imports.ImportModels}} // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./{{js $models}}";{{if not $imports.ImportInternal}} -{{end}}{{end}} -{{- if $imports.ImportInternal}} -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as $internal from "./{{js $internal}}"; +import * as $models from "./{{js $internal}}"; {{end}} {{- range .Injections}} {{.}} diff --git a/v3/internal/generator/render/templates/service.ts.tmpl b/v3/internal/generator/render/templates/service.ts.tmpl index aeada903730..0e8400a3b15 100644 --- a/v3/internal/generator/render/templates/service.ts.tmpl +++ b/v3/internal/generator/render/templates/service.ts.tmpl @@ -32,12 +32,7 @@ import * as {{jsimport .}} from "{{js .RelPath}}/{{js $models}}"; {{- if $imports.ImportModels}} // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./{{js $models}}";{{if not $imports.ImportInternal}} -{{end}}{{end}} -{{- if $imports.ImportInternal}} -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as $internal from "./{{js $internal}}"; +import * as $models from "./{{js $internal}}"; {{end}} {{- range .Injections}} {{.}} diff --git a/v3/internal/generator/render/type.go b/v3/internal/generator/render/type.go index dcb4f8e1bef..429ec704167 100644 --- a/v3/internal/generator/render/type.go +++ b/v3/internal/generator/render/type.go @@ -54,7 +54,7 @@ func (m *module) renderType(typ types.Type, quoted bool) (result string, nullabl } if types.Identical(typ, typeByteSlice) { - // encoding/json marshals byte arrays/slices as base64 strings + // encoding/json marshals byte slices as base64 strings return "string" + null, null != "" } @@ -211,10 +211,8 @@ func (m *module) renderNamedType(typ aliasOrNamed, quoted bool) (result string, var builder strings.Builder if typ.Obj().Pkg().Path() == m.Imports.Self { - if typ.Obj().Exported() && m.Imports.ImportModels { + if m.Imports.ImportModels { builder.WriteString("$models.") - } else if !typ.Obj().Exported() && m.Imports.ImportInternal { - builder.WriteString("$internal.") } } else { builder.WriteString(jsimport(m.Imports.External[typ.Obj().Pkg().Path()])) diff --git a/v3/internal/generator/testcases/aliases/main.go b/v3/internal/generator/testcases/aliases/main.go index b77422b77ff..902dfa9f04e 100644 --- a/v3/internal/generator/testcases/aliases/main.go +++ b/v3/internal/generator/testcases/aliases/main.go @@ -10,9 +10,12 @@ import ( // GreetService is great type GreetService int -// A nice type Alias +// A nice type Alias. type Alias = int +// A class alias. +type AliasedPerson = Person + // An empty struct alias. type EmptyAliasStruct = struct{} @@ -40,22 +43,30 @@ type Person struct { AliasedField Alias // A random alias field. } -// A generic struct containing an alias +// A generic struct containing an alias. type GenericPerson[T any] struct { Name T AliasedField Alias } -// Get someone +// Another class alias, but ordered after its aliased class. +type StrangelyAliasedPerson = Person + +// Get someone. func (GreetService) Get(aliasValue Alias) Person { return Person{"hello", aliasValue} } -// Get someone quite different +// Get someone quite different. func (GreetService) GetButDifferent() GenericPerson[bool] { return GenericPerson[bool]{true, 13} } +// Apparently, aliases are all the rage right now. +func (GreetService) GetButAliased(p AliasedPerson) StrangelyAliasedPerson { + return p +} + // Greet a lot of unusual things. func (GreetService) Greet(EmptyAliasStruct, EmptyStruct) AliasStruct { return AliasStruct{} diff --git a/v3/internal/generator/testcases/cycles/bound_types.json b/v3/internal/generator/testcases/cyclic_imports/bound_types.json similarity index 100% rename from v3/internal/generator/testcases/cycles/bound_types.json rename to v3/internal/generator/testcases/cyclic_imports/bound_types.json diff --git a/v3/internal/generator/testcases/cyclic_imports/main.go b/v3/internal/generator/testcases/cyclic_imports/main.go new file mode 100644 index 00000000000..088f50253fd --- /dev/null +++ b/v3/internal/generator/testcases/cyclic_imports/main.go @@ -0,0 +1,55 @@ +package main + +import ( + _ "embed" + "log" + + "github.com/wailsapp/wails/v3/pkg/application" +) + +// GreetService is great +type GreetService int + +type StructA struct { + B *structB +} + +type structB struct { + A *StructA +} + +type StructC struct { + D structD +} + +type structD struct { + E StructE +} + +type StructE struct{} + +// Make a cycle. +func (GreetService) MakeCycles() (_ StructA, _ StructC) { + return +} + +func NewGreetService() application.Service { + return application.NewService(new(GreetService)) +} + +func main() { + app := application.New(application.Options{ + Services: []application.Service{ + NewGreetService(), + }, + }) + + app.NewWebviewWindow() + + err := app.Run() + + if err != nil { + log.Fatal(err) + } + +} diff --git a/v3/internal/generator/testcases/cyclic_types/bound_types.json b/v3/internal/generator/testcases/cyclic_types/bound_types.json new file mode 100644 index 00000000000..a8b95e32197 --- /dev/null +++ b/v3/internal/generator/testcases/cyclic_types/bound_types.json @@ -0,0 +1,3 @@ +[ + ".GreetService" +] diff --git a/v3/internal/generator/testcases/cycles/main.go b/v3/internal/generator/testcases/cyclic_types/main.go similarity index 100% rename from v3/internal/generator/testcases/cycles/main.go rename to v3/internal/generator/testcases/cyclic_types/main.go diff --git a/v3/internal/generator/testcases/function_single_internal/bound_types.json b/v3/internal/generator/testcases/function_single_internal/bound_types.json new file mode 100644 index 00000000000..a8b95e32197 --- /dev/null +++ b/v3/internal/generator/testcases/function_single_internal/bound_types.json @@ -0,0 +1,3 @@ +[ + ".GreetService" +] diff --git a/v3/internal/generator/testcases/function_single_internal/main.go b/v3/internal/generator/testcases/function_single_internal/main.go new file mode 100644 index 00000000000..4be183e2fda --- /dev/null +++ b/v3/internal/generator/testcases/function_single_internal/main.go @@ -0,0 +1,61 @@ +package main + +import ( + "context" + _ "embed" + "log" + "net/http" + + "github.com/wailsapp/wails/v3/pkg/application" +) + +// GreetService is great +type GreetService struct { + SomeVariable int + lowerCase string +} + +// Greet someone +func (*GreetService) Greet(name string) string { + return "Hello " + name +} + +// Debugging name +func (*GreetService) ServiceName() string { + return "GreetService" +} + +// Lifecycle +func (*GreetService) ServiceStartup(context.Context, application.ServiceOptions) error { + return nil +} + +// Lifecycle +func (*GreetService) ServiceShutdown() error { + return nil +} + +// Serve some routes +func (*GreetService) ServeHTTP(http.ResponseWriter, *http.Request) { +} + +func NewGreetService() application.Service { + return application.NewService(&GreetService{}) +} + +func main() { + app := application.New(application.Options{ + Services: []application.Service{ + NewGreetService(), + }, + }) + + app.NewWebviewWindow() + + err := app.Run() + + if err != nil { + log.Fatal(err) + } + +} diff --git a/v3/internal/generator/testcases/no_bindings_here/person.go b/v3/internal/generator/testcases/no_bindings_here/person.go index 2da81745daf..5123c8b80ce 100644 --- a/v3/internal/generator/testcases/no_bindings_here/person.go +++ b/v3/internal/generator/testcases/no_bindings_here/person.go @@ -5,7 +5,8 @@ import "github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_he // Person is not a number. type Person struct { // They have a name. - Name string + Name string + Friends [4]Impersonator // Exactly 4 sketchy friends. } // Impersonator gets their fields from other people. diff --git a/v3/internal/generator/testcases/no_bindings_here/somemethods.go b/v3/internal/generator/testcases/no_bindings_here/somemethods.go index 5fcc66d4588..4b0602a6435 100644 --- a/v3/internal/generator/testcases/no_bindings_here/somemethods.go +++ b/v3/internal/generator/testcases/no_bindings_here/somemethods.go @@ -8,6 +8,6 @@ type SomeMethods struct { } // LikeThisOne is an example method that does nothing. -func (SomeMethods) LikeThisOne() (_ Person, _ Impersonator, _ HowDifferent[bool], _ PrivatePerson) { +func (SomeMethods) LikeThisOne() (_ Person, _ HowDifferent[bool], _ PrivatePerson) { return } diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/greetservice.js index 05e24e83026..6a281186a1f 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/greetservice.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/greetservice.js @@ -13,10 +13,10 @@ import {Call as $Call, Create as $Create} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** - * Get someone + * Get someone. * @param {$models.Alias} aliasValue * @returns {Promise<$models.Person> & { cancel(): void }} */ @@ -30,7 +30,21 @@ export function Get(aliasValue) { } /** - * Get someone quite different + * Apparently, aliases are all the rage right now. + * @param {$models.AliasedPerson} p + * @returns {Promise<$models.StrangelyAliasedPerson> & { cancel(): void }} + */ +export function GetButAliased(p) { + let $resultPromise = /** @type {any} */($Call.ByID(1896499664, p)); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + return $$createType0($result); + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +/** + * Get someone quite different. * @returns {Promise<$models.GenericPerson> & { cancel(): void }} */ export function GetButDifferent() { diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/internal.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/internal.js new file mode 100644 index 00000000000..1dcc6d53b5e --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/internal.js @@ -0,0 +1,166 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Create as $Create} from "/wails/runtime.js"; + +/** + * A nice type Alias. + * @typedef {number} Alias + */ + +/** + * A struct alias. + * This should be rendered as a typedef or interface in every mode. + * @typedef {Object} AliasStruct + * @property {number[]} Foo - A field with a comment. + * @property {string} [Bar] - Definitely not Foo. + * @property {string} [Baz] - Definitely not Foo. + * @property {OtherAliasStruct} Other - A nested alias struct. + */ + +/** + * An empty struct alias. + * @typedef { { + * } } EmptyAliasStruct + */ + +/** + * An empty struct. + */ +export class EmptyStruct { + /** + * Creates a new EmptyStruct instance. + * @param {Partial} [$$source = {}] - The source object to create the EmptyStruct. + */ + constructor($$source = {}) { + + Object.assign(this, $$source); + } + + /** + * Creates a new EmptyStruct instance from a string or object. + * @param {any} [$$source = {}] + * @returns {EmptyStruct} + */ + static createFrom($$source = {}) { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new EmptyStruct(/** @type {Partial} */($$parsedSource)); + } +} + +/** + * A generic struct containing an alias. + * @template T + */ +export class GenericPerson { + /** + * Creates a new GenericPerson instance. + * @param {Partial>} [$$source = {}] - The source object to create the GenericPerson. + */ + constructor($$source = {}) { + if (!("Name" in $$source)) { + /** + * @member + * @type {T | null} + */ + this["Name"] = null; + } + if (!("AliasedField" in $$source)) { + /** + * @member + * @type {Alias} + */ + this["AliasedField"] = 0; + } + + Object.assign(this, $$source); + } + + /** + * Given creation functions for each type parameter, + * returns a creation function for a concrete instance + * of the generic class GenericPerson. + * @template T + * @param {(source: any) => T} $$createParamT + * @returns {($$source?: any) => GenericPerson} + */ + static createFrom($$createParamT) { + const $$createField0_0 = $$createParamT; + return ($$source = {}) => { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Name" in $$parsedSource) { + $$parsedSource["Name"] = $$createField0_0($$parsedSource["Name"]); + } + return new GenericPerson(/** @type {Partial>} */($$parsedSource)); + }; + } +} + +/** + * Another struct alias. + * @typedef {Object} OtherAliasStruct + * @property {number[]} NoMoreIdeas + */ + +/** + * A non-generic struct containing an alias. + */ +export class Person { + /** + * Creates a new Person instance. + * @param {Partial} [$$source = {}] - The source object to create the Person. + */ + constructor($$source = {}) { + if (!("Name" in $$source)) { + /** + * The Person's name. + * @member + * @type {string} + */ + this["Name"] = ""; + } + if (!("AliasedField" in $$source)) { + /** + * A random alias field. + * @member + * @type {Alias} + */ + this["AliasedField"] = 0; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + * @param {any} [$$source = {}] + * @returns {Person} + */ + static createFrom($$source = {}) { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new Person(/** @type {Partial} */($$parsedSource)); + } +} + +/** + * A class alias. + */ +export const AliasedPerson = Person; + +/** + * A class alias. + * @typedef {Person} AliasedPerson + */ + +/** + * Another class alias, but ordered after its aliased class. + */ +export const StrangelyAliasedPerson = Person; + +/** + * Another class alias, but ordered after its aliased class. + * @typedef {Person} StrangelyAliasedPerson + */ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/models.js index 693a5e121b3..b5478bc4056 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/models.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/models.js @@ -2,145 +2,33 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import {Create as $Create} from "/wails/runtime.js"; +export { + AliasedPerson, + EmptyStruct, + GenericPerson, + Person, + StrangelyAliasedPerson +} from "./internal.js"; + +import * as $models from "./internal.js"; /** - * A nice type Alias - * @typedef {number} Alias + * A nice type Alias. + * @typedef {$models.Alias} Alias */ /** * A struct alias. * This should be rendered as a typedef or interface in every mode. - * @typedef {Object} AliasStruct - * @property {number[]} Foo - A field with a comment. - * @property {string} [Bar] - Definitely not Foo. - * @property {string} [Baz] - Definitely not Foo. - * @property {OtherAliasStruct} Other - A nested alias struct. + * @typedef {$models.AliasStruct} AliasStruct */ /** * An empty struct alias. - * @typedef { { - * } } EmptyAliasStruct - */ - -/** - * An empty struct. - */ -export class EmptyStruct { - /** - * Creates a new EmptyStruct instance. - * @param {Partial} [$$source = {}] - The source object to create the EmptyStruct. - */ - constructor($$source = {}) { - - Object.assign(this, $$source); - } - - /** - * Creates a new EmptyStruct instance from a string or object. - * @param {any} [$$source = {}] - * @returns {EmptyStruct} - */ - static createFrom($$source = {}) { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - return new EmptyStruct(/** @type {Partial} */($$parsedSource)); - } -} - -/** - * A generic struct containing an alias - * @template T + * @typedef {$models.EmptyAliasStruct} EmptyAliasStruct */ -export class GenericPerson { - /** - * Creates a new GenericPerson instance. - * @param {Partial>} [$$source = {}] - The source object to create the GenericPerson. - */ - constructor($$source = {}) { - if (!("Name" in $$source)) { - /** - * @member - * @type {T | null} - */ - this["Name"] = null; - } - if (!("AliasedField" in $$source)) { - /** - * @member - * @type {Alias} - */ - this["AliasedField"] = 0; - } - - Object.assign(this, $$source); - } - - /** - * Given creation functions for each type parameter, - * returns a creation function for a concrete instance - * of the generic class GenericPerson. - * @template T - * @param {(source: any) => T} $$createParamT - * @returns {($$source?: any) => GenericPerson} - */ - static createFrom($$createParamT) { - const $$createField0_0 = $$createParamT; - return ($$source = {}) => { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - if ("Name" in $$parsedSource) { - $$parsedSource["Name"] = $$createField0_0($$parsedSource["Name"]); - } - return new GenericPerson(/** @type {Partial>} */($$parsedSource)); - }; - } -} /** * Another struct alias. - * @typedef {Object} OtherAliasStruct - * @property {number[]} NoMoreIdeas - */ - -/** - * A non-generic struct containing an alias. + * @typedef {$models.OtherAliasStruct} OtherAliasStruct */ -export class Person { - /** - * Creates a new Person instance. - * @param {Partial} [$$source = {}] - The source object to create the Person. - */ - constructor($$source = {}) { - if (!("Name" in $$source)) { - /** - * The Person's name. - * @member - * @type {string} - */ - this["Name"] = ""; - } - if (!("AliasedField" in $$source)) { - /** - * A random alias field. - * @member - * @type {Alias} - */ - this["AliasedField"] = 0; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new Person instance from a string or object. - * @param {any} [$$source = {}] - * @returns {Person} - */ - static createFrom($$source = {}) { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - return new Person(/** @type {Partial} */($$parsedSource)); - } -} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/greetservice.js index 91b7651a8df..82a1394c246 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/greetservice.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/greetservice.js @@ -13,7 +13,7 @@ import {Call as $Call, Create as $Create} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Greet does XYZ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/internal.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/internal.js index e3eba58a609..bf2cf7b1efd 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/internal.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/internal.js @@ -6,6 +6,224 @@ // @ts-ignore: Unused imports import {Create as $Create} from "/wails/runtime.js"; +export class Embedded1 { + /** + * Creates a new Embedded1 instance. + * @param {Partial} [$$source = {}] - The source object to create the Embedded1. + */ + constructor($$source = {}) { + if (!("Friends" in $$source)) { + /** + * Friends should be shadowed in Person by a field of lesser depth + * @member + * @type {number} + */ + this["Friends"] = 0; + } + if (!("Vanish" in $$source)) { + /** + * Vanish should be omitted from Person because there is another field with same depth and no tag + * @member + * @type {number} + */ + this["Vanish"] = 0; + } + if (!("StillThere" in $$source)) { + /** + * StillThere should be shadowed in Person by other field with same depth and a json tag + * @member + * @type {string} + */ + this["StillThere"] = ""; + } + if (!("NamingThingsIsHard" in $$source)) { + /** + * NamingThingsIsHard is a law of programming + * @member + * @type {`${boolean}`} + */ + this["NamingThingsIsHard"] = "false"; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Embedded1 instance from a string or object. + * @param {any} [$$source = {}] + * @returns {Embedded1} + */ + static createFrom($$source = {}) { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new Embedded1(/** @type {Partial} */($$parsedSource)); + } +} + +/** + * @typedef {string} Embedded3 + */ + +/** + * Person represents a person + */ +export class Person { + /** + * Creates a new Person instance. + * @param {Partial} [$$source = {}] - The source object to create the Person. + */ + constructor($$source = {}) { + if (/** @type {any} */(false)) { + /** + * Titles is optional in JSON + * @member + * @type {Title[] | undefined} + */ + this["Titles"] = []; + } + if (!("Names" in $$source)) { + /** + * Names has a + * multiline comment + * @member + * @type {string[]} + */ + this["Names"] = []; + } + if (!("Partner" in $$source)) { + /** + * Partner has a custom and complex JSON key + * @member + * @type {Person | null} + */ + this["Partner"] = null; + } + if (!("Friends" in $$source)) { + /** + * @member + * @type {(Person | null)[]} + */ + this["Friends"] = []; + } + if (!("NamingThingsIsHard" in $$source)) { + /** + * NamingThingsIsHard is a law of programming + * @member + * @type {`${boolean}`} + */ + this["NamingThingsIsHard"] = "false"; + } + if (!("StillThere" in $$source)) { + /** + * StillThereButRenamed should shadow in Person the other field with same depth and no json tag + * @member + * @type {Embedded3 | null} + */ + this["StillThere"] = null; + } + if (!("-" in $$source)) { + /** + * StrangeNumber maps to "-" + * @member + * @type {number} + */ + this["-"] = 0; + } + if (!("Embedded3" in $$source)) { + /** + * Embedded3 should appear with key "Embedded3" + * @member + * @type {Embedded3} + */ + this["Embedded3"] = (/** @type {Embedded3} */("")); + } + if (!("StrangerNumber" in $$source)) { + /** + * StrangerNumber is serialized as a string + * @member + * @type {`${number}`} + */ + this["StrangerNumber"] = "0"; + } + if (/** @type {any} */(false)) { + /** + * StrangestString is optional and serialized as a JSON string + * @member + * @type {`"${string}"` | undefined} + */ + this["StrangestString"] = '""'; + } + if (/** @type {any} */(false)) { + /** + * StringStrangest is serialized as a JSON string and optional + * @member + * @type {`"${string}"` | undefined} + */ + this["StringStrangest"] = '""'; + } + if (/** @type {any} */(false)) { + /** + * embedded4 should be optional and appear with key "emb4" + * @member + * @type {embedded4 | undefined} + */ + this["emb4"] = (new embedded4()); + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + * @param {any} [$$source = {}] + * @returns {Person} + */ + static createFrom($$source = {}) { + const $$createField0_0 = $$createType0; + const $$createField1_0 = $$createType1; + const $$createField2_0 = $$createType3; + const $$createField3_0 = $$createType4; + const $$createField11_0 = $$createType5; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Titles" in $$parsedSource) { + $$parsedSource["Titles"] = $$createField0_0($$parsedSource["Titles"]); + } + if ("Names" in $$parsedSource) { + $$parsedSource["Names"] = $$createField1_0($$parsedSource["Names"]); + } + if ("Partner" in $$parsedSource) { + $$parsedSource["Partner"] = $$createField2_0($$parsedSource["Partner"]); + } + if ("Friends" in $$parsedSource) { + $$parsedSource["Friends"] = $$createField3_0($$parsedSource["Friends"]); + } + if ("emb4" in $$parsedSource) { + $$parsedSource["emb4"] = $$createField11_0($$parsedSource["emb4"]); + } + return new Person(/** @type {Partial} */($$parsedSource)); + } +} + +/** + * Title is a title + * @readonly + * @enum {string} + */ +export const Title = { + /** + * The Go zero value for the underlying type of the enum. + */ + $zero: "", + + /** + * Mister is a title + */ + Mister: "Mr", + Miss: "Miss", + Ms: "Ms", + Mrs: "Mrs", + Dr: "Dr", +}; + export class embedded4 { /** * Creates a new embedded4 instance. @@ -44,3 +262,11 @@ export class embedded4 { return new embedded4(/** @type {Partial} */($$parsedSource)); } } + +// Private type creation functions +const $$createType0 = $Create.Array($Create.Any); +const $$createType1 = $Create.Array($Create.Any); +const $$createType2 = Person.createFrom; +const $$createType3 = $Create.Nullable($$createType2); +const $$createType4 = $Create.Array($$createType3); +const $$createType5 = embedded4.createFrom; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/models.js index 48c2a3628a2..f3fc0cdbd52 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/models.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/models.js @@ -2,236 +2,14 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import {Create as $Create} from "/wails/runtime.js"; +export { + Embedded1, + Person, + Title +} from "./internal.js"; -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as $internal from "./internal.js"; - -export class Embedded1 { - /** - * Creates a new Embedded1 instance. - * @param {Partial} [$$source = {}] - The source object to create the Embedded1. - */ - constructor($$source = {}) { - if (!("Friends" in $$source)) { - /** - * Friends should be shadowed in Person by a field of lesser depth - * @member - * @type {number} - */ - this["Friends"] = 0; - } - if (!("Vanish" in $$source)) { - /** - * Vanish should be omitted from Person because there is another field with same depth and no tag - * @member - * @type {number} - */ - this["Vanish"] = 0; - } - if (!("StillThere" in $$source)) { - /** - * StillThere should be shadowed in Person by other field with same depth and a json tag - * @member - * @type {string} - */ - this["StillThere"] = ""; - } - if (!("NamingThingsIsHard" in $$source)) { - /** - * NamingThingsIsHard is a law of programming - * @member - * @type {`${boolean}`} - */ - this["NamingThingsIsHard"] = "false"; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new Embedded1 instance from a string or object. - * @param {any} [$$source = {}] - * @returns {Embedded1} - */ - static createFrom($$source = {}) { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - return new Embedded1(/** @type {Partial} */($$parsedSource)); - } -} +import * as $models from "./internal.js"; /** - * @typedef {string} Embedded3 + * @typedef {$models.Embedded3} Embedded3 */ - -/** - * Person represents a person - */ -export class Person { - /** - * Creates a new Person instance. - * @param {Partial} [$$source = {}] - The source object to create the Person. - */ - constructor($$source = {}) { - if (/** @type {any} */(false)) { - /** - * Titles is optional in JSON - * @member - * @type {Title[] | undefined} - */ - this["Titles"] = []; - } - if (!("Names" in $$source)) { - /** - * Names has a - * multiline comment - * @member - * @type {string[]} - */ - this["Names"] = []; - } - if (!("Partner" in $$source)) { - /** - * Partner has a custom and complex JSON key - * @member - * @type {Person | null} - */ - this["Partner"] = null; - } - if (!("Friends" in $$source)) { - /** - * @member - * @type {(Person | null)[]} - */ - this["Friends"] = []; - } - if (!("NamingThingsIsHard" in $$source)) { - /** - * NamingThingsIsHard is a law of programming - * @member - * @type {`${boolean}`} - */ - this["NamingThingsIsHard"] = "false"; - } - if (!("StillThere" in $$source)) { - /** - * StillThereButRenamed should shadow in Person the other field with same depth and no json tag - * @member - * @type {Embedded3 | null} - */ - this["StillThere"] = null; - } - if (!("-" in $$source)) { - /** - * StrangeNumber maps to "-" - * @member - * @type {number} - */ - this["-"] = 0; - } - if (!("Embedded3" in $$source)) { - /** - * Embedded3 should appear with key "Embedded3" - * @member - * @type {Embedded3} - */ - this["Embedded3"] = (/** @type {Embedded3} */("")); - } - if (!("StrangerNumber" in $$source)) { - /** - * StrangerNumber is serialized as a string - * @member - * @type {`${number}`} - */ - this["StrangerNumber"] = "0"; - } - if (/** @type {any} */(false)) { - /** - * StrangestString is optional and serialized as a JSON string - * @member - * @type {`"${string}"` | undefined} - */ - this["StrangestString"] = '""'; - } - if (/** @type {any} */(false)) { - /** - * StringStrangest is serialized as a JSON string and optional - * @member - * @type {`"${string}"` | undefined} - */ - this["StringStrangest"] = '""'; - } - if (/** @type {any} */(false)) { - /** - * embedded4 should be optional and appear with key "emb4" - * @member - * @type {$internal.embedded4 | undefined} - */ - this["emb4"] = (new $internal.embedded4()); - } - - Object.assign(this, $$source); - } - - /** - * Creates a new Person instance from a string or object. - * @param {any} [$$source = {}] - * @returns {Person} - */ - static createFrom($$source = {}) { - const $$createField0_0 = $$createType0; - const $$createField1_0 = $$createType1; - const $$createField2_0 = $$createType3; - const $$createField3_0 = $$createType4; - const $$createField11_0 = $$createType5; - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - if ("Titles" in $$parsedSource) { - $$parsedSource["Titles"] = $$createField0_0($$parsedSource["Titles"]); - } - if ("Names" in $$parsedSource) { - $$parsedSource["Names"] = $$createField1_0($$parsedSource["Names"]); - } - if ("Partner" in $$parsedSource) { - $$parsedSource["Partner"] = $$createField2_0($$parsedSource["Partner"]); - } - if ("Friends" in $$parsedSource) { - $$parsedSource["Friends"] = $$createField3_0($$parsedSource["Friends"]); - } - if ("emb4" in $$parsedSource) { - $$parsedSource["emb4"] = $$createField11_0($$parsedSource["emb4"]); - } - return new Person(/** @type {Partial} */($$parsedSource)); - } -} - -/** - * Title is a title - * @readonly - * @enum {string} - */ -export const Title = { - /** - * The Go zero value for the underlying type of the enum. - */ - $zero: "", - - /** - * Mister is a title - */ - Mister: "Mr", - Miss: "Miss", - Ms: "Ms", - Mrs: "Mrs", - Dr: "Dr", -}; - -// Private type creation functions -const $$createType0 = $Create.Array($Create.Any); -const $$createType1 = $Create.Array($Create.Any); -const $$createType2 = Person.createFrom; -const $$createType3 = $Create.Nullable($$createType2); -const $$createType4 = $Create.Array($$createType3); -const $$createType5 = $internal.embedded4.createFrom; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/greetservice.js index 6298ac99bab..4aa59c10c5e 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/greetservice.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/greetservice.js @@ -13,7 +13,7 @@ import {Call as $Call, Create as $Create} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Greet does XYZ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/internal.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/internal.js new file mode 100644 index 00000000000..70a01e64c02 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/internal.js @@ -0,0 +1,38 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Create as $Create} from "/wails/runtime.js"; + +/** + * Person represents a person + */ +export class Person { + /** + * Creates a new Person instance. + * @param {Partial} [$$source = {}] - The source object to create the Person. + */ + constructor($$source = {}) { + if (!("Name" in $$source)) { + /** + * @member + * @type {string} + */ + this["Name"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + * @param {any} [$$source = {}] + * @returns {Person} + */ + static createFrom($$source = {}) { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new Person(/** @type {Partial} */($$parsedSource)); + } +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/models.js index 70a01e64c02..1cf2e24188a 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/models.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/models.js @@ -2,37 +2,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import {Create as $Create} from "/wails/runtime.js"; - -/** - * Person represents a person - */ -export class Person { - /** - * Creates a new Person instance. - * @param {Partial} [$$source = {}] - The source object to create the Person. - */ - constructor($$source = {}) { - if (!("Name" in $$source)) { - /** - * @member - * @type {string} - */ - this["Name"] = ""; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new Person instance from a string or object. - * @param {any} [$$source = {}] - * @returns {Person} - */ - static createFrom($$source = {}) { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - return new Person(/** @type {Partial} */($$parsedSource)); - } -} +export { + Person +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/greetservice.js new file mode 100644 index 00000000000..0b866bbcdf0 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/greetservice.js @@ -0,0 +1,35 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import * as $models from "./internal.js"; + +/** + * Make a cycle. + * @returns {Promise<[$models.StructA, $models.StructC]> & { cancel(): void }} + */ +export function MakeCycles() { + let $resultPromise = /** @type {any} */($Call.ByID(440020721)); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + $result[0] = $$createType0($result[0]); + $result[1] = $$createType1($result[1]); + return $result; + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +// Private type creation functions +const $$createType0 = $models.StructA.createFrom; +const $$createType1 = $models.StructC.createFrom; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/index.js similarity index 100% rename from v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/index.js rename to v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/index.js diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/internal.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/internal.js new file mode 100644 index 00000000000..d101a661fb8 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/internal.js @@ -0,0 +1,164 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Create as $Create} from "/wails/runtime.js"; + +export class StructA { + /** + * Creates a new StructA instance. + * @param {Partial} [$$source = {}] - The source object to create the StructA. + */ + constructor($$source = {}) { + if (!("B" in $$source)) { + /** + * @member + * @type {structB | null} + */ + this["B"] = null; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new StructA instance from a string or object. + * @param {any} [$$source = {}] + * @returns {StructA} + */ + static createFrom($$source = {}) { + const $$createField0_0 = $$createType1; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("B" in $$parsedSource) { + $$parsedSource["B"] = $$createField0_0($$parsedSource["B"]); + } + return new StructA(/** @type {Partial} */($$parsedSource)); + } +} + +export class StructC { + /** + * Creates a new StructC instance. + * @param {Partial} [$$source = {}] - The source object to create the StructC. + */ + constructor($$source = {}) { + if (!("D" in $$source)) { + /** + * @member + * @type {structD} + */ + this["D"] = (new structD()); + } + + Object.assign(this, $$source); + } + + /** + * Creates a new StructC instance from a string or object. + * @param {any} [$$source = {}] + * @returns {StructC} + */ + static createFrom($$source = {}) { + const $$createField0_0 = $$createType2; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("D" in $$parsedSource) { + $$parsedSource["D"] = $$createField0_0($$parsedSource["D"]); + } + return new StructC(/** @type {Partial} */($$parsedSource)); + } +} + +export class StructE { + /** + * Creates a new StructE instance. + * @param {Partial} [$$source = {}] - The source object to create the StructE. + */ + constructor($$source = {}) { + + Object.assign(this, $$source); + } + + /** + * Creates a new StructE instance from a string or object. + * @param {any} [$$source = {}] + * @returns {StructE} + */ + static createFrom($$source = {}) { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new StructE(/** @type {Partial} */($$parsedSource)); + } +} + +export class structB { + /** + * Creates a new structB instance. + * @param {Partial} [$$source = {}] - The source object to create the structB. + */ + constructor($$source = {}) { + if (!("A" in $$source)) { + /** + * @member + * @type {StructA | null} + */ + this["A"] = null; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new structB instance from a string or object. + * @param {any} [$$source = {}] + * @returns {structB} + */ + static createFrom($$source = {}) { + const $$createField0_0 = $$createType4; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("A" in $$parsedSource) { + $$parsedSource["A"] = $$createField0_0($$parsedSource["A"]); + } + return new structB(/** @type {Partial} */($$parsedSource)); + } +} + +export class structD { + /** + * Creates a new structD instance. + * @param {Partial} [$$source = {}] - The source object to create the structD. + */ + constructor($$source = {}) { + if (!("E" in $$source)) { + /** + * @member + * @type {StructE} + */ + this["E"] = (new StructE()); + } + + Object.assign(this, $$source); + } + + /** + * Creates a new structD instance from a string or object. + * @param {any} [$$source = {}] + * @returns {structD} + */ + static createFrom($$source = {}) { + const $$createField0_0 = $$createType5; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("E" in $$parsedSource) { + $$parsedSource["E"] = $$createField0_0($$parsedSource["E"]); + } + return new structD(/** @type {Partial} */($$parsedSource)); + } +} + +// Private type creation functions +const $$createType0 = structB.createFrom; +const $$createType1 = $Create.Nullable($$createType0); +const $$createType2 = structD.createFrom; +const $$createType3 = StructA.createFrom; +const $$createType4 = $Create.Nullable($$createType3); +const $$createType5 = StructE.createFrom; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/models.js new file mode 100644 index 00000000000..7978fe3d88d --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/models.js @@ -0,0 +1,9 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +export { + StructA, + StructC, + StructE +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/greetservice.js similarity index 98% rename from v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/greetservice.js rename to v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/greetservice.js index 428da2dbdd7..1a3f31b28d6 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/greetservice.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/greetservice.js @@ -13,7 +13,7 @@ import {Call as $Call, Create as $Create} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Make a cycle. diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/index.js similarity index 100% rename from v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/index.js rename to v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/index.js diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/internal.js similarity index 100% rename from v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/models.js rename to v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/internal.js diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/models.js new file mode 100644 index 00000000000..1d70efd7035 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/models.js @@ -0,0 +1,18 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as $models from "./internal.js"; + +/** + * @typedef {$models.Alias} Alias + */ + +/** + * @typedef {$models.Cyclic} Cyclic + */ + +/** + * @template T + * @typedef {$models.GenericCyclic} GenericCyclic + */ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/greetservice.js index 61730be16ad..cdd83d94782 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/greetservice.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/greetservice.js @@ -13,7 +13,7 @@ import {Call as $Call, Create as $Create} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Greet does XYZ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/internal.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/internal.js new file mode 100644 index 00000000000..1ddcaf0e031 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/internal.js @@ -0,0 +1,66 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Create as $Create} from "/wails/runtime.js"; + +/** + * Person represents a person + */ +export class Person { + /** + * Creates a new Person instance. + * @param {Partial} [$$source = {}] - The source object to create the Person. + */ + constructor($$source = {}) { + if (!("Title" in $$source)) { + /** + * @member + * @type {Title} + */ + this["Title"] = (/** @type {Title} */("")); + } + if (!("Name" in $$source)) { + /** + * @member + * @type {string} + */ + this["Name"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + * @param {any} [$$source = {}] + * @returns {Person} + */ + static createFrom($$source = {}) { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new Person(/** @type {Partial} */($$parsedSource)); + } +} + +/** + * Title is a title + * @readonly + * @enum {string} + */ +export const Title = { + /** + * The Go zero value for the underlying type of the enum. + */ + $zero: "", + + /** + * Mister is a title + */ + Mister: "Mr", + Miss: "Miss", + Ms: "Ms", + Mrs: "Mrs", + Dr: "Dr", +}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/models.js index 1ddcaf0e031..25b4a5f6550 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/models.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/models.js @@ -2,65 +2,7 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import {Create as $Create} from "/wails/runtime.js"; - -/** - * Person represents a person - */ -export class Person { - /** - * Creates a new Person instance. - * @param {Partial} [$$source = {}] - The source object to create the Person. - */ - constructor($$source = {}) { - if (!("Title" in $$source)) { - /** - * @member - * @type {Title} - */ - this["Title"] = (/** @type {Title} */("")); - } - if (!("Name" in $$source)) { - /** - * @member - * @type {string} - */ - this["Name"] = ""; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new Person instance from a string or object. - * @param {any} [$$source = {}] - * @returns {Person} - */ - static createFrom($$source = {}) { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - return new Person(/** @type {Partial} */($$parsedSource)); - } -} - -/** - * Title is a title - * @readonly - * @enum {string} - */ -export const Title = { - /** - * The Go zero value for the underlying type of the enum. - */ - $zero: "", - - /** - * Mister is a title - */ - Mister: "Mr", - Miss: "Miss", - Ms: "Ms", - Mrs: "Mrs", - Dr: "Dr", -}; +export { + Person, + Title +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/internal.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/internal.js new file mode 100644 index 00000000000..0e7acabe2ad --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/internal.js @@ -0,0 +1,27 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Create as $Create} from "/wails/runtime.js"; + +/** + * @readonly + * @enum {string} + */ +export const Title = { + /** + * The Go zero value for the underlying type of the enum. + */ + $zero: "", + + /** + * Mister is a title + */ + Mister: "Mr", + Miss: "Miss", + Ms: "Ms", + Mrs: "Mrs", + Dr: "Dr", +}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/models.js index 0e7acabe2ad..389f670e2bf 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/models.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/models.js @@ -2,26 +2,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import {Create as $Create} from "/wails/runtime.js"; - -/** - * @readonly - * @enum {string} - */ -export const Title = { - /** - * The Go zero value for the underlying type of the enum. - */ - $zero: "", - - /** - * Mister is a title - */ - Mister: "Mr", - Miss: "Miss", - Ms: "Ms", - Mrs: "Mrs", - Dr: "Dr", -}; +export { + Title +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/greetservice.js index 5f8cf55b5c7..bf314a446f3 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/greetservice.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/greetservice.js @@ -13,7 +13,7 @@ import {Call as $Call, Create as $Create} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Greet does XYZ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/internal.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/internal.js new file mode 100644 index 00000000000..8609395634e --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/internal.js @@ -0,0 +1,57 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Create as $Create} from "/wails/runtime.js"; + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import * as services$0 from "./services/models.js"; + +/** + * Person is a person + */ +export class Person { + /** + * Creates a new Person instance. + * @param {Partial} [$$source = {}] - The source object to create the Person. + */ + constructor($$source = {}) { + if (!("Name" in $$source)) { + /** + * @member + * @type {string} + */ + this["Name"] = ""; + } + if (!("Address" in $$source)) { + /** + * @member + * @type {services$0.Address | null} + */ + this["Address"] = null; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + * @param {any} [$$source = {}] + * @returns {Person} + */ + static createFrom($$source = {}) { + const $$createField1_0 = $$createType1; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Address" in $$parsedSource) { + $$parsedSource["Address"] = $$createField1_0($$parsedSource["Address"]); + } + return new Person(/** @type {Partial} */($$parsedSource)); + } +} + +// Private type creation functions +const $$createType0 = services$0.Address.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/models.js index 8609395634e..1cf2e24188a 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/models.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/models.js @@ -2,56 +2,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import {Create as $Create} from "/wails/runtime.js"; - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as services$0 from "./services/models.js"; - -/** - * Person is a person - */ -export class Person { - /** - * Creates a new Person instance. - * @param {Partial} [$$source = {}] - The source object to create the Person. - */ - constructor($$source = {}) { - if (!("Name" in $$source)) { - /** - * @member - * @type {string} - */ - this["Name"] = ""; - } - if (!("Address" in $$source)) { - /** - * @member - * @type {services$0.Address | null} - */ - this["Address"] = null; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new Person instance from a string or object. - * @param {any} [$$source = {}] - * @returns {Person} - */ - static createFrom($$source = {}) { - const $$createField1_0 = $$createType1; - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - if ("Address" in $$parsedSource) { - $$parsedSource["Address"] = $$createField1_0($$parsedSource["Address"]); - } - return new Person(/** @type {Partial} */($$parsedSource)); - } -} - -// Private type creation functions -const $$createType0 = services$0.Address.createFrom; -const $$createType1 = $Create.Nullable($$createType0); +export { + Person +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/internal.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/internal.js new file mode 100644 index 00000000000..fb1176deece --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/internal.js @@ -0,0 +1,49 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Create as $Create} from "/wails/runtime.js"; + +export class Address { + /** + * Creates a new Address instance. + * @param {Partial
} [$$source = {}] - The source object to create the Address. + */ + constructor($$source = {}) { + if (!("Street" in $$source)) { + /** + * @member + * @type {string} + */ + this["Street"] = ""; + } + if (!("State" in $$source)) { + /** + * @member + * @type {string} + */ + this["State"] = ""; + } + if (!("Country" in $$source)) { + /** + * @member + * @type {string} + */ + this["Country"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Address instance from a string or object. + * @param {any} [$$source = {}] + * @returns {Address} + */ + static createFrom($$source = {}) { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new Address(/** @type {Partial
} */($$parsedSource)); + } +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/models.js index fb1176deece..6820003a0c3 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/models.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/models.js @@ -2,48 +2,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import {Create as $Create} from "/wails/runtime.js"; - -export class Address { - /** - * Creates a new Address instance. - * @param {Partial
} [$$source = {}] - The source object to create the Address. - */ - constructor($$source = {}) { - if (!("Street" in $$source)) { - /** - * @member - * @type {string} - */ - this["Street"] = ""; - } - if (!("State" in $$source)) { - /** - * @member - * @type {string} - */ - this["State"] = ""; - } - if (!("Country" in $$source)) { - /** - * @member - * @type {string} - */ - this["Country"] = ""; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new Address instance from a string or object. - * @param {any} [$$source = {}] - * @returns {Address} - */ - static createFrom($$source = {}) { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - return new Address(/** @type {Partial
} */($$parsedSource)); - } -} +export { + Address +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/otherservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/otherservice.js index 447b0a588a3..0801673d969 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/otherservice.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/otherservice.js @@ -14,7 +14,7 @@ import {Call as $Call, Create as $Create} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Yay does this and that diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/greetservice.js index 5f8cf55b5c7..bf314a446f3 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/greetservice.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/greetservice.js @@ -13,7 +13,7 @@ import {Call as $Call, Create as $Create} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Greet does XYZ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/internal.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/internal.js new file mode 100644 index 00000000000..5b28ee2f662 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/internal.js @@ -0,0 +1,54 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Create as $Create} from "/wails/runtime.js"; + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import * as other$0 from "./services/other/models.js"; + +export class Person { + /** + * Creates a new Person instance. + * @param {Partial} [$$source = {}] - The source object to create the Person. + */ + constructor($$source = {}) { + if (!("Name" in $$source)) { + /** + * @member + * @type {string} + */ + this["Name"] = ""; + } + if (!("Address" in $$source)) { + /** + * @member + * @type {other$0.Address | null} + */ + this["Address"] = null; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + * @param {any} [$$source = {}] + * @returns {Person} + */ + static createFrom($$source = {}) { + const $$createField1_0 = $$createType1; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Address" in $$parsedSource) { + $$parsedSource["Address"] = $$createField1_0($$parsedSource["Address"]); + } + return new Person(/** @type {Partial} */($$parsedSource)); + } +} + +// Private type creation functions +const $$createType0 = other$0.Address.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/models.js index 5b28ee2f662..1cf2e24188a 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/models.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/models.js @@ -2,53 +2,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import {Create as $Create} from "/wails/runtime.js"; - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as other$0 from "./services/other/models.js"; - -export class Person { - /** - * Creates a new Person instance. - * @param {Partial} [$$source = {}] - The source object to create the Person. - */ - constructor($$source = {}) { - if (!("Name" in $$source)) { - /** - * @member - * @type {string} - */ - this["Name"] = ""; - } - if (!("Address" in $$source)) { - /** - * @member - * @type {other$0.Address | null} - */ - this["Address"] = null; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new Person instance from a string or object. - * @param {any} [$$source = {}] - * @returns {Person} - */ - static createFrom($$source = {}) { - const $$createField1_0 = $$createType1; - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - if ("Address" in $$parsedSource) { - $$parsedSource["Address"] = $$createField1_0($$parsedSource["Address"]); - } - return new Person(/** @type {Partial} */($$parsedSource)); - } -} - -// Private type creation functions -const $$createType0 = other$0.Address.createFrom; -const $$createType1 = $Create.Nullable($$createType0); +export { + Person +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/internal.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/internal.js new file mode 100644 index 00000000000..fb1176deece --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/internal.js @@ -0,0 +1,49 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Create as $Create} from "/wails/runtime.js"; + +export class Address { + /** + * Creates a new Address instance. + * @param {Partial
} [$$source = {}] - The source object to create the Address. + */ + constructor($$source = {}) { + if (!("Street" in $$source)) { + /** + * @member + * @type {string} + */ + this["Street"] = ""; + } + if (!("State" in $$source)) { + /** + * @member + * @type {string} + */ + this["State"] = ""; + } + if (!("Country" in $$source)) { + /** + * @member + * @type {string} + */ + this["Country"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Address instance from a string or object. + * @param {any} [$$source = {}] + * @returns {Address} + */ + static createFrom($$source = {}) { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new Address(/** @type {Partial
} */($$parsedSource)); + } +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/models.js index fb1176deece..6820003a0c3 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/models.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/models.js @@ -2,48 +2,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import {Create as $Create} from "/wails/runtime.js"; - -export class Address { - /** - * Creates a new Address instance. - * @param {Partial
} [$$source = {}] - The source object to create the Address. - */ - constructor($$source = {}) { - if (!("Street" in $$source)) { - /** - * @member - * @type {string} - */ - this["Street"] = ""; - } - if (!("State" in $$source)) { - /** - * @member - * @type {string} - */ - this["State"] = ""; - } - if (!("Country" in $$source)) { - /** - * @member - * @type {string} - */ - this["Country"] = ""; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new Address instance from a string or object. - * @param {any} [$$source = {}] - * @returns {Address} - */ - static createFrom($$source = {}) { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - return new Address(/** @type {Partial
} */($$parsedSource)); - } -} +export { + Address +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/otherservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/otherservice.js index 4bece70b665..44352d47678 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/otherservice.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/otherservice.js @@ -14,7 +14,7 @@ import {Call as $Call, Create as $Create} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Yay does this and that diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_internal/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_internal/greetservice.js new file mode 100644 index 00000000000..d20ce5791de --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_internal/greetservice.js @@ -0,0 +1,22 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * Greet someone + * @param {string} name + * @returns {Promise & { cancel(): void }} + */ +export function Greet(name) { + let $resultPromise = /** @type {any} */($Call.ByID(1411160069, name)); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_internal/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_internal/index.js new file mode 100644 index 00000000000..fdf1ff435a9 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_internal/index.js @@ -0,0 +1,8 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/internal.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/internal.js index ec8a847eb33..d09e0de6adf 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/internal.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/internal.js @@ -6,6 +6,115 @@ // @ts-ignore: Unused imports import {Create as $Create} from "/wails/runtime.js"; +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import * as other$0 from "./other/models.js"; + +/** + * HowDifferent is a curious kind of person + * that lets other people decide how they are different. + * @template How + */ +export class HowDifferent { + /** + * Creates a new HowDifferent instance. + * @param {Partial>} [$$source = {}] - The source object to create the HowDifferent. + */ + constructor($$source = {}) { + if (!("Name" in $$source)) { + /** + * They have a name as well. + * @member + * @type {string} + */ + this["Name"] = ""; + } + if (!("Differences" in $$source)) { + /** + * But they may have many differences. + * @member + * @type {{ [_: string]: How | null }[]} + */ + this["Differences"] = []; + } + + Object.assign(this, $$source); + } + + /** + * Given creation functions for each type parameter, + * returns a creation function for a concrete instance + * of the generic class HowDifferent. + * @template How + * @param {(source: any) => How} $$createParamHow + * @returns {($$source?: any) => HowDifferent} + */ + static createFrom($$createParamHow) { + const $$createField1_0 = $$createType1($$createParamHow); + return ($$source = {}) => { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Differences" in $$parsedSource) { + $$parsedSource["Differences"] = $$createField1_0($$parsedSource["Differences"]); + } + return new HowDifferent(/** @type {Partial>} */($$parsedSource)); + }; + } +} + +/** + * Impersonator gets their fields from other people. + */ +export const Impersonator = other$0.OtherPerson; + +/** + * Impersonator gets their fields from other people. + * @typedef {other$0.OtherPerson} Impersonator + */ + +/** + * Person is not a number. + */ +export class Person { + /** + * Creates a new Person instance. + * @param {Partial} [$$source = {}] - The source object to create the Person. + */ + constructor($$source = {}) { + if (!("Name" in $$source)) { + /** + * They have a name. + * @member + * @type {string} + */ + this["Name"] = ""; + } + if (!("Friends" in $$source)) { + /** + * Exactly 4 sketchy friends. + * @member + * @type {Impersonator[]} + */ + this["Friends"] = Array.from({ length: 4 }, () => (new Impersonator())); + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + * @param {any} [$$source = {}] + * @returns {Person} + */ + static createFrom($$source = {}) { + const $$createField1_0 = $$createType3; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Friends" in $$parsedSource) { + $$parsedSource["Friends"] = $$createField1_0($$parsedSource["Friends"]); + } + return new Person(/** @type {Partial} */($$parsedSource)); + } +} + export class personImpl { /** * Creates a new personImpl instance. @@ -28,6 +137,14 @@ export class personImpl { */ this["Name"] = ""; } + if (!("Friends" in $$source)) { + /** + * Exactly 4 sketchy friends. + * @member + * @type {Impersonator[]} + */ + this["Friends"] = Array.from({ length: 4 }, () => (new Impersonator())); + } Object.assign(this, $$source); } @@ -38,7 +155,27 @@ export class personImpl { * @returns {personImpl} */ static createFrom($$source = {}) { + const $$createField2_0 = $$createType3; let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Friends" in $$parsedSource) { + $$parsedSource["Friends"] = $$createField2_0($$parsedSource["Friends"]); + } return new personImpl(/** @type {Partial} */($$parsedSource)); } } + +/** + * PrivatePerson gets their fields from hidden sources. + */ +export const PrivatePerson = personImpl; + +/** + * PrivatePerson gets their fields from hidden sources. + * @typedef {personImpl} PrivatePerson + */ + +// Private type creation functions +const $$createType0 = ($$createParamHow) => $Create.Map($Create.Any, $$createParamHow); +const $$createType1 = ($$createParamHow) => $Create.Array($$createType0($$createParamHow)); +const $$createType2 = Impersonator.createFrom; +const $$createType3 = $Create.Array($$createType2); diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/models.js index e4c9b35a147..1515d48ea41 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/models.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/models.js @@ -2,121 +2,9 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import {Create as $Create} from "/wails/runtime.js"; - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as other$0 from "./other/models.js"; - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as $internal from "./internal.js"; - -/** - * HowDifferent is a curious kind of person - * that lets other people decide how they are different. - * @template How - */ -export class HowDifferent { - /** - * Creates a new HowDifferent instance. - * @param {Partial>} [$$source = {}] - The source object to create the HowDifferent. - */ - constructor($$source = {}) { - if (!("Name" in $$source)) { - /** - * They have a name as well. - * @member - * @type {string} - */ - this["Name"] = ""; - } - if (!("Differences" in $$source)) { - /** - * But they may have many differences. - * @member - * @type {{ [_: string]: How | null }[]} - */ - this["Differences"] = []; - } - - Object.assign(this, $$source); - } - - /** - * Given creation functions for each type parameter, - * returns a creation function for a concrete instance - * of the generic class HowDifferent. - * @template How - * @param {(source: any) => How} $$createParamHow - * @returns {($$source?: any) => HowDifferent} - */ - static createFrom($$createParamHow) { - const $$createField1_0 = $$createType1($$createParamHow); - return ($$source = {}) => { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - if ("Differences" in $$parsedSource) { - $$parsedSource["Differences"] = $$createField1_0($$parsedSource["Differences"]); - } - return new HowDifferent(/** @type {Partial>} */($$parsedSource)); - }; - } -} - -/** - * Impersonator gets their fields from other people. - */ -export const Impersonator = other$0.OtherPerson; - -/** - * Impersonator gets their fields from other people. - * @typedef {other$0.OtherPerson} Impersonator - */ - -/** - * Person is not a number. - */ -export class Person { - /** - * Creates a new Person instance. - * @param {Partial} [$$source = {}] - The source object to create the Person. - */ - constructor($$source = {}) { - if (!("Name" in $$source)) { - /** - * They have a name. - * @member - * @type {string} - */ - this["Name"] = ""; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new Person instance from a string or object. - * @param {any} [$$source = {}] - * @returns {Person} - */ - static createFrom($$source = {}) { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - return new Person(/** @type {Partial} */($$parsedSource)); - } -} - -/** - * PrivatePerson gets their fields from hidden sources. - */ -export const PrivatePerson = $internal.personImpl; - -/** - * PrivatePerson gets their fields from hidden sources. - * @typedef {$internal.personImpl} PrivatePerson - */ - -// Private type creation functions -const $$createType0 = ($$createParamHow) => $Create.Map($Create.Any, $$createParamHow); -const $$createType1 = ($$createParamHow) => $Create.Array($$createType0($$createParamHow)); +export { + HowDifferent, + Impersonator, + Person, + PrivatePerson +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/internal.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/internal.js new file mode 100644 index 00000000000..455e369fc11 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/internal.js @@ -0,0 +1,60 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Create as $Create} from "/wails/runtime.js"; + +/** + * OtherPerson is like a person, but different. + * @template T + */ +export class OtherPerson { + /** + * Creates a new OtherPerson instance. + * @param {Partial>} [$$source = {}] - The source object to create the OtherPerson. + */ + constructor($$source = {}) { + if (!("Name" in $$source)) { + /** + * They have a name as well. + * @member + * @type {string} + */ + this["Name"] = ""; + } + if (!("Differences" in $$source)) { + /** + * But they may have many differences. + * @member + * @type {(T | null)[]} + */ + this["Differences"] = []; + } + + Object.assign(this, $$source); + } + + /** + * Given creation functions for each type parameter, + * returns a creation function for a concrete instance + * of the generic class OtherPerson. + * @template T + * @param {(source: any) => T} $$createParamT + * @returns {($$source?: any) => OtherPerson} + */ + static createFrom($$createParamT) { + const $$createField1_0 = $$createType0($$createParamT); + return ($$source = {}) => { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Differences" in $$parsedSource) { + $$parsedSource["Differences"] = $$createField1_0($$parsedSource["Differences"]); + } + return new OtherPerson(/** @type {Partial>} */($$parsedSource)); + }; + } +} + +// Private type creation functions +const $$createType0 = ($$createParamT) => $Create.Array($$createParamT); diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/models.js index 455e369fc11..30bb60b19ed 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/models.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/models.js @@ -2,59 +2,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import {Create as $Create} from "/wails/runtime.js"; - -/** - * OtherPerson is like a person, but different. - * @template T - */ -export class OtherPerson { - /** - * Creates a new OtherPerson instance. - * @param {Partial>} [$$source = {}] - The source object to create the OtherPerson. - */ - constructor($$source = {}) { - if (!("Name" in $$source)) { - /** - * They have a name as well. - * @member - * @type {string} - */ - this["Name"] = ""; - } - if (!("Differences" in $$source)) { - /** - * But they may have many differences. - * @member - * @type {(T | null)[]} - */ - this["Differences"] = []; - } - - Object.assign(this, $$source); - } - - /** - * Given creation functions for each type parameter, - * returns a creation function for a concrete instance - * of the generic class OtherPerson. - * @template T - * @param {(source: any) => T} $$createParamT - * @returns {($$source?: any) => OtherPerson} - */ - static createFrom($$createParamT) { - const $$createField1_0 = $$createType0($$createParamT); - return ($$source = {}) => { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - if ("Differences" in $$parsedSource) { - $$parsedSource["Differences"] = $$createField1_0($$parsedSource["Differences"]); - } - return new OtherPerson(/** @type {Partial>} */($$parsedSource)); - }; - } -} - -// Private type creation functions -const $$createType0 = ($$createParamT) => $Create.Array($$createParamT); +export { + OtherPerson +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/somemethods.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/somemethods.js index 7cc779033f1..232f0ec41d6 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/somemethods.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/somemethods.js @@ -13,11 +13,11 @@ import {Call as $Call, Create as $Create} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * LikeThisOne is an example method that does nothing. - * @returns {Promise<[$models.Person, $models.Impersonator, $models.HowDifferent, $models.PrivatePerson]> & { cancel(): void }} + * @returns {Promise<[$models.Person, $models.HowDifferent, $models.PrivatePerson]> & { cancel(): void }} */ export function LikeThisOne() { let $resultPromise = /** @type {any} */($Call.ByID(2124352079)); @@ -25,7 +25,6 @@ export function LikeThisOne() { $result[0] = $$createType0($result[0]); $result[1] = $$createType1($result[1]); $result[2] = $$createType2($result[2]); - $result[3] = $$createType3($result[3]); return $result; })); $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); @@ -43,6 +42,5 @@ export function LikeThisOtherOne() { // Private type creation functions const $$createType0 = $models.Person.createFrom; -const $$createType1 = $models.Impersonator.createFrom; -const $$createType2 = $models.HowDifferent.createFrom($Create.Any); -const $$createType3 = $models.PrivatePerson.createFrom; +const $$createType1 = $models.HowDifferent.createFrom($Create.Any); +const $$createType2 = $models.PrivatePerson.createFrom; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/embedservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/embedservice.js index 6a68dd0a1ad..f85f737a416 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/embedservice.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/embedservice.js @@ -17,7 +17,7 @@ import * as nobindingshere$0 from "../no_bindings_here/models.js"; /** * LikeThisOne is an example method that does nothing. - * @returns {Promise<[nobindingshere$0.Person, nobindingshere$0.Impersonator, nobindingshere$0.HowDifferent, nobindingshere$0.PrivatePerson]> & { cancel(): void }} + * @returns {Promise<[nobindingshere$0.Person, nobindingshere$0.HowDifferent, nobindingshere$0.PrivatePerson]> & { cancel(): void }} */ export function LikeThisOne() { let $resultPromise = /** @type {any} */($Call.ByID(2590614085)); @@ -25,7 +25,6 @@ export function LikeThisOne() { $result[0] = $$createType0($result[0]); $result[1] = $$createType1($result[1]); $result[2] = $$createType2($result[2]); - $result[3] = $$createType3($result[3]); return $result; })); $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); @@ -43,6 +42,5 @@ export function LikeThisOtherOne() { // Private type creation functions const $$createType0 = nobindingshere$0.Person.createFrom; -const $$createType1 = nobindingshere$0.Impersonator.createFrom; -const $$createType2 = nobindingshere$0.HowDifferent.createFrom($Create.Any); -const $$createType3 = nobindingshere$0.PrivatePerson.createFrom; +const $$createType1 = nobindingshere$0.HowDifferent.createFrom($Create.Any); +const $$createType2 = nobindingshere$0.PrivatePerson.createFrom; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/greetservice.js index 5f8cf55b5c7..bf314a446f3 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/greetservice.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/greetservice.js @@ -13,7 +13,7 @@ import {Call as $Call, Create as $Create} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Greet does XYZ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/internal.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/internal.js new file mode 100644 index 00000000000..e187cce2235 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/internal.js @@ -0,0 +1,54 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Create as $Create} from "/wails/runtime.js"; + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import * as services$0 from "./services/models.js"; + +export class Person { + /** + * Creates a new Person instance. + * @param {Partial} [$$source = {}] - The source object to create the Person. + */ + constructor($$source = {}) { + if (!("Name" in $$source)) { + /** + * @member + * @type {string} + */ + this["Name"] = ""; + } + if (!("Address" in $$source)) { + /** + * @member + * @type {services$0.Address | null} + */ + this["Address"] = null; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + * @param {any} [$$source = {}] + * @returns {Person} + */ + static createFrom($$source = {}) { + const $$createField1_0 = $$createType1; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Address" in $$parsedSource) { + $$parsedSource["Address"] = $$createField1_0($$parsedSource["Address"]); + } + return new Person(/** @type {Partial} */($$parsedSource)); + } +} + +// Private type creation functions +const $$createType0 = services$0.Address.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/models.js index e187cce2235..1cf2e24188a 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/models.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/models.js @@ -2,53 +2,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import {Create as $Create} from "/wails/runtime.js"; - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as services$0 from "./services/models.js"; - -export class Person { - /** - * Creates a new Person instance. - * @param {Partial} [$$source = {}] - The source object to create the Person. - */ - constructor($$source = {}) { - if (!("Name" in $$source)) { - /** - * @member - * @type {string} - */ - this["Name"] = ""; - } - if (!("Address" in $$source)) { - /** - * @member - * @type {services$0.Address | null} - */ - this["Address"] = null; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new Person instance from a string or object. - * @param {any} [$$source = {}] - * @returns {Person} - */ - static createFrom($$source = {}) { - const $$createField1_0 = $$createType1; - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - if ("Address" in $$parsedSource) { - $$parsedSource["Address"] = $$createField1_0($$parsedSource["Address"]); - } - return new Person(/** @type {Partial} */($$parsedSource)); - } -} - -// Private type creation functions -const $$createType0 = services$0.Address.createFrom; -const $$createType1 = $Create.Nullable($$createType0); +export { + Person +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/internal.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/internal.js new file mode 100644 index 00000000000..fb1176deece --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/internal.js @@ -0,0 +1,49 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Create as $Create} from "/wails/runtime.js"; + +export class Address { + /** + * Creates a new Address instance. + * @param {Partial
} [$$source = {}] - The source object to create the Address. + */ + constructor($$source = {}) { + if (!("Street" in $$source)) { + /** + * @member + * @type {string} + */ + this["Street"] = ""; + } + if (!("State" in $$source)) { + /** + * @member + * @type {string} + */ + this["State"] = ""; + } + if (!("Country" in $$source)) { + /** + * @member + * @type {string} + */ + this["Country"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Address instance from a string or object. + * @param {any} [$$source = {}] + * @returns {Address} + */ + static createFrom($$source = {}) { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new Address(/** @type {Partial
} */($$parsedSource)); + } +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/models.js index fb1176deece..6820003a0c3 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/models.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/models.js @@ -2,48 +2,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import {Create as $Create} from "/wails/runtime.js"; - -export class Address { - /** - * Creates a new Address instance. - * @param {Partial
} [$$source = {}] - The source object to create the Address. - */ - constructor($$source = {}) { - if (!("Street" in $$source)) { - /** - * @member - * @type {string} - */ - this["Street"] = ""; - } - if (!("State" in $$source)) { - /** - * @member - * @type {string} - */ - this["State"] = ""; - } - if (!("Country" in $$source)) { - /** - * @member - * @type {string} - */ - this["Country"] = ""; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new Address instance from a string or object. - * @param {any} [$$source = {}] - * @returns {Address} - */ - static createFrom($$source = {}) { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - return new Address(/** @type {Partial
} */($$parsedSource)); - } -} +export { + Address +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/otherservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/otherservice.js index d61e9e689ed..f07d455b846 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/otherservice.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/otherservice.js @@ -14,7 +14,7 @@ import {Call as $Call, Create as $Create} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Yay does this and that diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/greetservice.js index a4ba468b849..dc5afe8ea33 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/greetservice.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/greetservice.js @@ -13,7 +13,7 @@ import {Call as $Call, Create as $Create} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * @param {number[]} $in diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/internal.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/internal.js new file mode 100644 index 00000000000..660f38b29f0 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/internal.js @@ -0,0 +1,57 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Create as $Create} from "/wails/runtime.js"; + +export class Person { + /** + * Creates a new Person instance. + * @param {Partial} [$$source = {}] - The source object to create the Person. + */ + constructor($$source = {}) { + if (!("Name" in $$source)) { + /** + * @member + * @type {string} + */ + this["Name"] = ""; + } + if (!("Parent" in $$source)) { + /** + * @member + * @type {Person | null} + */ + this["Parent"] = null; + } + if (!("Details" in $$source)) { + /** + * @member + * @type {{"Age": number, "Address": {"Street": string}}} + */ + this["Details"] = {"Age": 0, "Address": {"Street": ""}}; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + * @param {any} [$$source = {}] + * @returns {Person} + */ + static createFrom($$source = {}) { + const $$createField1_0 = $$createType1; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Parent" in $$parsedSource) { + $$parsedSource["Parent"] = $$createField1_0($$parsedSource["Parent"]); + } + return new Person(/** @type {Partial} */($$parsedSource)); + } +} + +// Private type creation functions +const $$createType0 = Person.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/models.js index 660f38b29f0..1cf2e24188a 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/models.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/models.js @@ -2,56 +2,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import {Create as $Create} from "/wails/runtime.js"; - -export class Person { - /** - * Creates a new Person instance. - * @param {Partial} [$$source = {}] - The source object to create the Person. - */ - constructor($$source = {}) { - if (!("Name" in $$source)) { - /** - * @member - * @type {string} - */ - this["Name"] = ""; - } - if (!("Parent" in $$source)) { - /** - * @member - * @type {Person | null} - */ - this["Parent"] = null; - } - if (!("Details" in $$source)) { - /** - * @member - * @type {{"Age": number, "Address": {"Street": string}}} - */ - this["Details"] = {"Age": 0, "Address": {"Street": ""}}; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new Person instance from a string or object. - * @param {any} [$$source = {}] - * @returns {Person} - */ - static createFrom($$source = {}) { - const $$createField1_0 = $$createType1; - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - if ("Parent" in $$parsedSource) { - $$parsedSource["Parent"] = $$createField1_0($$parsedSource["Parent"]); - } - return new Person(/** @type {Partial} */($$parsedSource)); - } -} - -// Private type creation functions -const $$createType0 = Person.createFrom; -const $$createType1 = $Create.Nullable($$createType0); +export { + Person +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/greetservice.js index a4ba468b849..dc5afe8ea33 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/greetservice.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/greetservice.js @@ -13,7 +13,7 @@ import {Call as $Call, Create as $Create} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * @param {number[]} $in diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/internal.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/internal.js new file mode 100644 index 00000000000..660f38b29f0 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/internal.js @@ -0,0 +1,57 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Create as $Create} from "/wails/runtime.js"; + +export class Person { + /** + * Creates a new Person instance. + * @param {Partial} [$$source = {}] - The source object to create the Person. + */ + constructor($$source = {}) { + if (!("Name" in $$source)) { + /** + * @member + * @type {string} + */ + this["Name"] = ""; + } + if (!("Parent" in $$source)) { + /** + * @member + * @type {Person | null} + */ + this["Parent"] = null; + } + if (!("Details" in $$source)) { + /** + * @member + * @type {{"Age": number, "Address": {"Street": string}}} + */ + this["Details"] = {"Age": 0, "Address": {"Street": ""}}; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + * @param {any} [$$source = {}] + * @returns {Person} + */ + static createFrom($$source = {}) { + const $$createField1_0 = $$createType1; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Parent" in $$parsedSource) { + $$parsedSource["Parent"] = $$createField1_0($$parsedSource["Parent"]); + } + return new Person(/** @type {Partial} */($$parsedSource)); + } +} + +// Private type creation functions +const $$createType0 = Person.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/models.js index 660f38b29f0..1cf2e24188a 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/models.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/models.js @@ -2,56 +2,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import {Create as $Create} from "/wails/runtime.js"; - -export class Person { - /** - * Creates a new Person instance. - * @param {Partial} [$$source = {}] - The source object to create the Person. - */ - constructor($$source = {}) { - if (!("Name" in $$source)) { - /** - * @member - * @type {string} - */ - this["Name"] = ""; - } - if (!("Parent" in $$source)) { - /** - * @member - * @type {Person | null} - */ - this["Parent"] = null; - } - if (!("Details" in $$source)) { - /** - * @member - * @type {{"Age": number, "Address": {"Street": string}}} - */ - this["Details"] = {"Age": 0, "Address": {"Street": ""}}; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new Person instance from a string or object. - * @param {any} [$$source = {}] - * @returns {Person} - */ - static createFrom($$source = {}) { - const $$createField1_0 = $$createType1; - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - if ("Parent" in $$parsedSource) { - $$parsedSource["Parent"] = $$createField1_0($$parsedSource["Parent"]); - } - return new Person(/** @type {Partial} */($$parsedSource)); - } -} - -// Private type creation functions -const $$createType0 = Person.createFrom; -const $$createType1 = $Create.Nullable($$createType0); +export { + Person +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/greetservice.js index 5f8cf55b5c7..bf314a446f3 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/greetservice.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/greetservice.js @@ -13,7 +13,7 @@ import {Call as $Call, Create as $Create} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Greet does XYZ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/internal.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/internal.js new file mode 100644 index 00000000000..0daca427b60 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/internal.js @@ -0,0 +1,58 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Create as $Create} from "/wails/runtime.js"; + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import * as services$0 from "./services/models.js"; + +/** + * Person is a person! + * They have a name and an address + */ +export class Person { + /** + * Creates a new Person instance. + * @param {Partial} [$$source = {}] - The source object to create the Person. + */ + constructor($$source = {}) { + if (!("Name" in $$source)) { + /** + * @member + * @type {string} + */ + this["Name"] = ""; + } + if (!("Address" in $$source)) { + /** + * @member + * @type {services$0.Address | null} + */ + this["Address"] = null; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + * @param {any} [$$source = {}] + * @returns {Person} + */ + static createFrom($$source = {}) { + const $$createField1_0 = $$createType1; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Address" in $$parsedSource) { + $$parsedSource["Address"] = $$createField1_0($$parsedSource["Address"]); + } + return new Person(/** @type {Partial} */($$parsedSource)); + } +} + +// Private type creation functions +const $$createType0 = services$0.Address.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/models.js index 0daca427b60..1cf2e24188a 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/models.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/models.js @@ -2,57 +2,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import {Create as $Create} from "/wails/runtime.js"; - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as services$0 from "./services/models.js"; - -/** - * Person is a person! - * They have a name and an address - */ -export class Person { - /** - * Creates a new Person instance. - * @param {Partial} [$$source = {}] - The source object to create the Person. - */ - constructor($$source = {}) { - if (!("Name" in $$source)) { - /** - * @member - * @type {string} - */ - this["Name"] = ""; - } - if (!("Address" in $$source)) { - /** - * @member - * @type {services$0.Address | null} - */ - this["Address"] = null; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new Person instance from a string or object. - * @param {any} [$$source = {}] - * @returns {Person} - */ - static createFrom($$source = {}) { - const $$createField1_0 = $$createType1; - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - if ("Address" in $$parsedSource) { - $$parsedSource["Address"] = $$createField1_0($$parsedSource["Address"]); - } - return new Person(/** @type {Partial} */($$parsedSource)); - } -} - -// Private type creation functions -const $$createType0 = services$0.Address.createFrom; -const $$createType1 = $Create.Nullable($$createType0); +export { + Person +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/internal.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/internal.js new file mode 100644 index 00000000000..fb1176deece --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/internal.js @@ -0,0 +1,49 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Create as $Create} from "/wails/runtime.js"; + +export class Address { + /** + * Creates a new Address instance. + * @param {Partial
} [$$source = {}] - The source object to create the Address. + */ + constructor($$source = {}) { + if (!("Street" in $$source)) { + /** + * @member + * @type {string} + */ + this["Street"] = ""; + } + if (!("State" in $$source)) { + /** + * @member + * @type {string} + */ + this["State"] = ""; + } + if (!("Country" in $$source)) { + /** + * @member + * @type {string} + */ + this["Country"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Address instance from a string or object. + * @param {any} [$$source = {}] + * @returns {Address} + */ + static createFrom($$source = {}) { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new Address(/** @type {Partial
} */($$parsedSource)); + } +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/models.js index fb1176deece..6820003a0c3 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/models.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/models.js @@ -2,48 +2,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import {Create as $Create} from "/wails/runtime.js"; - -export class Address { - /** - * Creates a new Address instance. - * @param {Partial
} [$$source = {}] - The source object to create the Address. - */ - constructor($$source = {}) { - if (!("Street" in $$source)) { - /** - * @member - * @type {string} - */ - this["Street"] = ""; - } - if (!("State" in $$source)) { - /** - * @member - * @type {string} - */ - this["State"] = ""; - } - if (!("Country" in $$source)) { - /** - * @member - * @type {string} - */ - this["Country"] = ""; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new Address instance from a string or object. - * @param {any} [$$source = {}] - * @returns {Address} - */ - static createFrom($$source = {}) { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - return new Address(/** @type {Partial
} */($$parsedSource)); - } -} +export { + Address +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/otherservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/otherservice.js index 63319bf0634..87188036210 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/otherservice.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/otherservice.js @@ -14,7 +14,7 @@ import {Call as $Call, Create as $Create} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Yay does this and that diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/greetservice.js index d3405c129be..e0c51be34ef 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/greetservice.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/greetservice.js @@ -13,10 +13,10 @@ import {Call as $Call, Create as $Create} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** - * Get someone + * Get someone. * @param {$models.Alias} aliasValue * @returns {Promise<$models.Person> & { cancel(): void }} */ @@ -30,7 +30,21 @@ export function Get(aliasValue) { } /** - * Get someone quite different + * Apparently, aliases are all the rage right now. + * @param {$models.AliasedPerson} p + * @returns {Promise<$models.StrangelyAliasedPerson> & { cancel(): void }} + */ +export function GetButAliased(p) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.GetButAliased", p)); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + return $$createType0($result); + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +/** + * Get someone quite different. * @returns {Promise<$models.GenericPerson> & { cancel(): void }} */ export function GetButDifferent() { diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/internal.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/internal.js new file mode 100644 index 00000000000..1dcc6d53b5e --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/internal.js @@ -0,0 +1,166 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Create as $Create} from "/wails/runtime.js"; + +/** + * A nice type Alias. + * @typedef {number} Alias + */ + +/** + * A struct alias. + * This should be rendered as a typedef or interface in every mode. + * @typedef {Object} AliasStruct + * @property {number[]} Foo - A field with a comment. + * @property {string} [Bar] - Definitely not Foo. + * @property {string} [Baz] - Definitely not Foo. + * @property {OtherAliasStruct} Other - A nested alias struct. + */ + +/** + * An empty struct alias. + * @typedef { { + * } } EmptyAliasStruct + */ + +/** + * An empty struct. + */ +export class EmptyStruct { + /** + * Creates a new EmptyStruct instance. + * @param {Partial} [$$source = {}] - The source object to create the EmptyStruct. + */ + constructor($$source = {}) { + + Object.assign(this, $$source); + } + + /** + * Creates a new EmptyStruct instance from a string or object. + * @param {any} [$$source = {}] + * @returns {EmptyStruct} + */ + static createFrom($$source = {}) { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new EmptyStruct(/** @type {Partial} */($$parsedSource)); + } +} + +/** + * A generic struct containing an alias. + * @template T + */ +export class GenericPerson { + /** + * Creates a new GenericPerson instance. + * @param {Partial>} [$$source = {}] - The source object to create the GenericPerson. + */ + constructor($$source = {}) { + if (!("Name" in $$source)) { + /** + * @member + * @type {T | null} + */ + this["Name"] = null; + } + if (!("AliasedField" in $$source)) { + /** + * @member + * @type {Alias} + */ + this["AliasedField"] = 0; + } + + Object.assign(this, $$source); + } + + /** + * Given creation functions for each type parameter, + * returns a creation function for a concrete instance + * of the generic class GenericPerson. + * @template T + * @param {(source: any) => T} $$createParamT + * @returns {($$source?: any) => GenericPerson} + */ + static createFrom($$createParamT) { + const $$createField0_0 = $$createParamT; + return ($$source = {}) => { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Name" in $$parsedSource) { + $$parsedSource["Name"] = $$createField0_0($$parsedSource["Name"]); + } + return new GenericPerson(/** @type {Partial>} */($$parsedSource)); + }; + } +} + +/** + * Another struct alias. + * @typedef {Object} OtherAliasStruct + * @property {number[]} NoMoreIdeas + */ + +/** + * A non-generic struct containing an alias. + */ +export class Person { + /** + * Creates a new Person instance. + * @param {Partial} [$$source = {}] - The source object to create the Person. + */ + constructor($$source = {}) { + if (!("Name" in $$source)) { + /** + * The Person's name. + * @member + * @type {string} + */ + this["Name"] = ""; + } + if (!("AliasedField" in $$source)) { + /** + * A random alias field. + * @member + * @type {Alias} + */ + this["AliasedField"] = 0; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + * @param {any} [$$source = {}] + * @returns {Person} + */ + static createFrom($$source = {}) { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new Person(/** @type {Partial} */($$parsedSource)); + } +} + +/** + * A class alias. + */ +export const AliasedPerson = Person; + +/** + * A class alias. + * @typedef {Person} AliasedPerson + */ + +/** + * Another class alias, but ordered after its aliased class. + */ +export const StrangelyAliasedPerson = Person; + +/** + * Another class alias, but ordered after its aliased class. + * @typedef {Person} StrangelyAliasedPerson + */ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/models.js index 693a5e121b3..b5478bc4056 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/models.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/models.js @@ -2,145 +2,33 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import {Create as $Create} from "/wails/runtime.js"; +export { + AliasedPerson, + EmptyStruct, + GenericPerson, + Person, + StrangelyAliasedPerson +} from "./internal.js"; + +import * as $models from "./internal.js"; /** - * A nice type Alias - * @typedef {number} Alias + * A nice type Alias. + * @typedef {$models.Alias} Alias */ /** * A struct alias. * This should be rendered as a typedef or interface in every mode. - * @typedef {Object} AliasStruct - * @property {number[]} Foo - A field with a comment. - * @property {string} [Bar] - Definitely not Foo. - * @property {string} [Baz] - Definitely not Foo. - * @property {OtherAliasStruct} Other - A nested alias struct. + * @typedef {$models.AliasStruct} AliasStruct */ /** * An empty struct alias. - * @typedef { { - * } } EmptyAliasStruct - */ - -/** - * An empty struct. - */ -export class EmptyStruct { - /** - * Creates a new EmptyStruct instance. - * @param {Partial} [$$source = {}] - The source object to create the EmptyStruct. - */ - constructor($$source = {}) { - - Object.assign(this, $$source); - } - - /** - * Creates a new EmptyStruct instance from a string or object. - * @param {any} [$$source = {}] - * @returns {EmptyStruct} - */ - static createFrom($$source = {}) { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - return new EmptyStruct(/** @type {Partial} */($$parsedSource)); - } -} - -/** - * A generic struct containing an alias - * @template T + * @typedef {$models.EmptyAliasStruct} EmptyAliasStruct */ -export class GenericPerson { - /** - * Creates a new GenericPerson instance. - * @param {Partial>} [$$source = {}] - The source object to create the GenericPerson. - */ - constructor($$source = {}) { - if (!("Name" in $$source)) { - /** - * @member - * @type {T | null} - */ - this["Name"] = null; - } - if (!("AliasedField" in $$source)) { - /** - * @member - * @type {Alias} - */ - this["AliasedField"] = 0; - } - - Object.assign(this, $$source); - } - - /** - * Given creation functions for each type parameter, - * returns a creation function for a concrete instance - * of the generic class GenericPerson. - * @template T - * @param {(source: any) => T} $$createParamT - * @returns {($$source?: any) => GenericPerson} - */ - static createFrom($$createParamT) { - const $$createField0_0 = $$createParamT; - return ($$source = {}) => { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - if ("Name" in $$parsedSource) { - $$parsedSource["Name"] = $$createField0_0($$parsedSource["Name"]); - } - return new GenericPerson(/** @type {Partial>} */($$parsedSource)); - }; - } -} /** * Another struct alias. - * @typedef {Object} OtherAliasStruct - * @property {number[]} NoMoreIdeas - */ - -/** - * A non-generic struct containing an alias. + * @typedef {$models.OtherAliasStruct} OtherAliasStruct */ -export class Person { - /** - * Creates a new Person instance. - * @param {Partial} [$$source = {}] - The source object to create the Person. - */ - constructor($$source = {}) { - if (!("Name" in $$source)) { - /** - * The Person's name. - * @member - * @type {string} - */ - this["Name"] = ""; - } - if (!("AliasedField" in $$source)) { - /** - * A random alias field. - * @member - * @type {Alias} - */ - this["AliasedField"] = 0; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new Person instance from a string or object. - * @param {any} [$$source = {}] - * @returns {Person} - */ - static createFrom($$source = {}) { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - return new Person(/** @type {Partial} */($$parsedSource)); - } -} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/greetservice.js index 7d3bc5c0160..c712cde8bb3 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/greetservice.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/greetservice.js @@ -13,7 +13,7 @@ import {Call as $Call, Create as $Create} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Greet does XYZ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/internal.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/internal.js index e3eba58a609..bf2cf7b1efd 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/internal.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/internal.js @@ -6,6 +6,224 @@ // @ts-ignore: Unused imports import {Create as $Create} from "/wails/runtime.js"; +export class Embedded1 { + /** + * Creates a new Embedded1 instance. + * @param {Partial} [$$source = {}] - The source object to create the Embedded1. + */ + constructor($$source = {}) { + if (!("Friends" in $$source)) { + /** + * Friends should be shadowed in Person by a field of lesser depth + * @member + * @type {number} + */ + this["Friends"] = 0; + } + if (!("Vanish" in $$source)) { + /** + * Vanish should be omitted from Person because there is another field with same depth and no tag + * @member + * @type {number} + */ + this["Vanish"] = 0; + } + if (!("StillThere" in $$source)) { + /** + * StillThere should be shadowed in Person by other field with same depth and a json tag + * @member + * @type {string} + */ + this["StillThere"] = ""; + } + if (!("NamingThingsIsHard" in $$source)) { + /** + * NamingThingsIsHard is a law of programming + * @member + * @type {`${boolean}`} + */ + this["NamingThingsIsHard"] = "false"; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Embedded1 instance from a string or object. + * @param {any} [$$source = {}] + * @returns {Embedded1} + */ + static createFrom($$source = {}) { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new Embedded1(/** @type {Partial} */($$parsedSource)); + } +} + +/** + * @typedef {string} Embedded3 + */ + +/** + * Person represents a person + */ +export class Person { + /** + * Creates a new Person instance. + * @param {Partial} [$$source = {}] - The source object to create the Person. + */ + constructor($$source = {}) { + if (/** @type {any} */(false)) { + /** + * Titles is optional in JSON + * @member + * @type {Title[] | undefined} + */ + this["Titles"] = []; + } + if (!("Names" in $$source)) { + /** + * Names has a + * multiline comment + * @member + * @type {string[]} + */ + this["Names"] = []; + } + if (!("Partner" in $$source)) { + /** + * Partner has a custom and complex JSON key + * @member + * @type {Person | null} + */ + this["Partner"] = null; + } + if (!("Friends" in $$source)) { + /** + * @member + * @type {(Person | null)[]} + */ + this["Friends"] = []; + } + if (!("NamingThingsIsHard" in $$source)) { + /** + * NamingThingsIsHard is a law of programming + * @member + * @type {`${boolean}`} + */ + this["NamingThingsIsHard"] = "false"; + } + if (!("StillThere" in $$source)) { + /** + * StillThereButRenamed should shadow in Person the other field with same depth and no json tag + * @member + * @type {Embedded3 | null} + */ + this["StillThere"] = null; + } + if (!("-" in $$source)) { + /** + * StrangeNumber maps to "-" + * @member + * @type {number} + */ + this["-"] = 0; + } + if (!("Embedded3" in $$source)) { + /** + * Embedded3 should appear with key "Embedded3" + * @member + * @type {Embedded3} + */ + this["Embedded3"] = (/** @type {Embedded3} */("")); + } + if (!("StrangerNumber" in $$source)) { + /** + * StrangerNumber is serialized as a string + * @member + * @type {`${number}`} + */ + this["StrangerNumber"] = "0"; + } + if (/** @type {any} */(false)) { + /** + * StrangestString is optional and serialized as a JSON string + * @member + * @type {`"${string}"` | undefined} + */ + this["StrangestString"] = '""'; + } + if (/** @type {any} */(false)) { + /** + * StringStrangest is serialized as a JSON string and optional + * @member + * @type {`"${string}"` | undefined} + */ + this["StringStrangest"] = '""'; + } + if (/** @type {any} */(false)) { + /** + * embedded4 should be optional and appear with key "emb4" + * @member + * @type {embedded4 | undefined} + */ + this["emb4"] = (new embedded4()); + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + * @param {any} [$$source = {}] + * @returns {Person} + */ + static createFrom($$source = {}) { + const $$createField0_0 = $$createType0; + const $$createField1_0 = $$createType1; + const $$createField2_0 = $$createType3; + const $$createField3_0 = $$createType4; + const $$createField11_0 = $$createType5; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Titles" in $$parsedSource) { + $$parsedSource["Titles"] = $$createField0_0($$parsedSource["Titles"]); + } + if ("Names" in $$parsedSource) { + $$parsedSource["Names"] = $$createField1_0($$parsedSource["Names"]); + } + if ("Partner" in $$parsedSource) { + $$parsedSource["Partner"] = $$createField2_0($$parsedSource["Partner"]); + } + if ("Friends" in $$parsedSource) { + $$parsedSource["Friends"] = $$createField3_0($$parsedSource["Friends"]); + } + if ("emb4" in $$parsedSource) { + $$parsedSource["emb4"] = $$createField11_0($$parsedSource["emb4"]); + } + return new Person(/** @type {Partial} */($$parsedSource)); + } +} + +/** + * Title is a title + * @readonly + * @enum {string} + */ +export const Title = { + /** + * The Go zero value for the underlying type of the enum. + */ + $zero: "", + + /** + * Mister is a title + */ + Mister: "Mr", + Miss: "Miss", + Ms: "Ms", + Mrs: "Mrs", + Dr: "Dr", +}; + export class embedded4 { /** * Creates a new embedded4 instance. @@ -44,3 +262,11 @@ export class embedded4 { return new embedded4(/** @type {Partial} */($$parsedSource)); } } + +// Private type creation functions +const $$createType0 = $Create.Array($Create.Any); +const $$createType1 = $Create.Array($Create.Any); +const $$createType2 = Person.createFrom; +const $$createType3 = $Create.Nullable($$createType2); +const $$createType4 = $Create.Array($$createType3); +const $$createType5 = embedded4.createFrom; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/models.js index 48c2a3628a2..f3fc0cdbd52 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/models.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/models.js @@ -2,236 +2,14 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import {Create as $Create} from "/wails/runtime.js"; +export { + Embedded1, + Person, + Title +} from "./internal.js"; -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as $internal from "./internal.js"; - -export class Embedded1 { - /** - * Creates a new Embedded1 instance. - * @param {Partial} [$$source = {}] - The source object to create the Embedded1. - */ - constructor($$source = {}) { - if (!("Friends" in $$source)) { - /** - * Friends should be shadowed in Person by a field of lesser depth - * @member - * @type {number} - */ - this["Friends"] = 0; - } - if (!("Vanish" in $$source)) { - /** - * Vanish should be omitted from Person because there is another field with same depth and no tag - * @member - * @type {number} - */ - this["Vanish"] = 0; - } - if (!("StillThere" in $$source)) { - /** - * StillThere should be shadowed in Person by other field with same depth and a json tag - * @member - * @type {string} - */ - this["StillThere"] = ""; - } - if (!("NamingThingsIsHard" in $$source)) { - /** - * NamingThingsIsHard is a law of programming - * @member - * @type {`${boolean}`} - */ - this["NamingThingsIsHard"] = "false"; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new Embedded1 instance from a string or object. - * @param {any} [$$source = {}] - * @returns {Embedded1} - */ - static createFrom($$source = {}) { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - return new Embedded1(/** @type {Partial} */($$parsedSource)); - } -} +import * as $models from "./internal.js"; /** - * @typedef {string} Embedded3 + * @typedef {$models.Embedded3} Embedded3 */ - -/** - * Person represents a person - */ -export class Person { - /** - * Creates a new Person instance. - * @param {Partial} [$$source = {}] - The source object to create the Person. - */ - constructor($$source = {}) { - if (/** @type {any} */(false)) { - /** - * Titles is optional in JSON - * @member - * @type {Title[] | undefined} - */ - this["Titles"] = []; - } - if (!("Names" in $$source)) { - /** - * Names has a - * multiline comment - * @member - * @type {string[]} - */ - this["Names"] = []; - } - if (!("Partner" in $$source)) { - /** - * Partner has a custom and complex JSON key - * @member - * @type {Person | null} - */ - this["Partner"] = null; - } - if (!("Friends" in $$source)) { - /** - * @member - * @type {(Person | null)[]} - */ - this["Friends"] = []; - } - if (!("NamingThingsIsHard" in $$source)) { - /** - * NamingThingsIsHard is a law of programming - * @member - * @type {`${boolean}`} - */ - this["NamingThingsIsHard"] = "false"; - } - if (!("StillThere" in $$source)) { - /** - * StillThereButRenamed should shadow in Person the other field with same depth and no json tag - * @member - * @type {Embedded3 | null} - */ - this["StillThere"] = null; - } - if (!("-" in $$source)) { - /** - * StrangeNumber maps to "-" - * @member - * @type {number} - */ - this["-"] = 0; - } - if (!("Embedded3" in $$source)) { - /** - * Embedded3 should appear with key "Embedded3" - * @member - * @type {Embedded3} - */ - this["Embedded3"] = (/** @type {Embedded3} */("")); - } - if (!("StrangerNumber" in $$source)) { - /** - * StrangerNumber is serialized as a string - * @member - * @type {`${number}`} - */ - this["StrangerNumber"] = "0"; - } - if (/** @type {any} */(false)) { - /** - * StrangestString is optional and serialized as a JSON string - * @member - * @type {`"${string}"` | undefined} - */ - this["StrangestString"] = '""'; - } - if (/** @type {any} */(false)) { - /** - * StringStrangest is serialized as a JSON string and optional - * @member - * @type {`"${string}"` | undefined} - */ - this["StringStrangest"] = '""'; - } - if (/** @type {any} */(false)) { - /** - * embedded4 should be optional and appear with key "emb4" - * @member - * @type {$internal.embedded4 | undefined} - */ - this["emb4"] = (new $internal.embedded4()); - } - - Object.assign(this, $$source); - } - - /** - * Creates a new Person instance from a string or object. - * @param {any} [$$source = {}] - * @returns {Person} - */ - static createFrom($$source = {}) { - const $$createField0_0 = $$createType0; - const $$createField1_0 = $$createType1; - const $$createField2_0 = $$createType3; - const $$createField3_0 = $$createType4; - const $$createField11_0 = $$createType5; - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - if ("Titles" in $$parsedSource) { - $$parsedSource["Titles"] = $$createField0_0($$parsedSource["Titles"]); - } - if ("Names" in $$parsedSource) { - $$parsedSource["Names"] = $$createField1_0($$parsedSource["Names"]); - } - if ("Partner" in $$parsedSource) { - $$parsedSource["Partner"] = $$createField2_0($$parsedSource["Partner"]); - } - if ("Friends" in $$parsedSource) { - $$parsedSource["Friends"] = $$createField3_0($$parsedSource["Friends"]); - } - if ("emb4" in $$parsedSource) { - $$parsedSource["emb4"] = $$createField11_0($$parsedSource["emb4"]); - } - return new Person(/** @type {Partial} */($$parsedSource)); - } -} - -/** - * Title is a title - * @readonly - * @enum {string} - */ -export const Title = { - /** - * The Go zero value for the underlying type of the enum. - */ - $zero: "", - - /** - * Mister is a title - */ - Mister: "Mr", - Miss: "Miss", - Ms: "Ms", - Mrs: "Mrs", - Dr: "Dr", -}; - -// Private type creation functions -const $$createType0 = $Create.Array($Create.Any); -const $$createType1 = $Create.Array($Create.Any); -const $$createType2 = Person.createFrom; -const $$createType3 = $Create.Nullable($$createType2); -const $$createType4 = $Create.Array($$createType3); -const $$createType5 = $internal.embedded4.createFrom; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/greetservice.js index 1ea653b3372..52dd85da720 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/greetservice.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/greetservice.js @@ -13,7 +13,7 @@ import {Call as $Call, Create as $Create} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Greet does XYZ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/internal.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/internal.js new file mode 100644 index 00000000000..70a01e64c02 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/internal.js @@ -0,0 +1,38 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Create as $Create} from "/wails/runtime.js"; + +/** + * Person represents a person + */ +export class Person { + /** + * Creates a new Person instance. + * @param {Partial} [$$source = {}] - The source object to create the Person. + */ + constructor($$source = {}) { + if (!("Name" in $$source)) { + /** + * @member + * @type {string} + */ + this["Name"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + * @param {any} [$$source = {}] + * @returns {Person} + */ + static createFrom($$source = {}) { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new Person(/** @type {Partial} */($$parsedSource)); + } +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/models.js index 70a01e64c02..1cf2e24188a 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/models.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/models.js @@ -2,37 +2,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import {Create as $Create} from "/wails/runtime.js"; - -/** - * Person represents a person - */ -export class Person { - /** - * Creates a new Person instance. - * @param {Partial} [$$source = {}] - The source object to create the Person. - */ - constructor($$source = {}) { - if (!("Name" in $$source)) { - /** - * @member - * @type {string} - */ - this["Name"] = ""; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new Person instance from a string or object. - * @param {any} [$$source = {}] - * @returns {Person} - */ - static createFrom($$source = {}) { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - return new Person(/** @type {Partial} */($$parsedSource)); - } -} +export { + Person +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/greetservice.js new file mode 100644 index 00000000000..899b569b8bd --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/greetservice.js @@ -0,0 +1,35 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import * as $models from "./internal.js"; + +/** + * Make a cycle. + * @returns {Promise<[$models.StructA, $models.StructC]> & { cancel(): void }} + */ +export function MakeCycles() { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.MakeCycles")); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + $result[0] = $$createType0($result[0]); + $result[1] = $$createType1($result[1]); + return $result; + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +// Private type creation functions +const $$createType0 = $models.StructA.createFrom; +const $$createType1 = $models.StructC.createFrom; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/index.js similarity index 100% rename from v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/index.js rename to v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/index.js diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/internal.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/internal.js new file mode 100644 index 00000000000..d101a661fb8 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/internal.js @@ -0,0 +1,164 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Create as $Create} from "/wails/runtime.js"; + +export class StructA { + /** + * Creates a new StructA instance. + * @param {Partial} [$$source = {}] - The source object to create the StructA. + */ + constructor($$source = {}) { + if (!("B" in $$source)) { + /** + * @member + * @type {structB | null} + */ + this["B"] = null; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new StructA instance from a string or object. + * @param {any} [$$source = {}] + * @returns {StructA} + */ + static createFrom($$source = {}) { + const $$createField0_0 = $$createType1; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("B" in $$parsedSource) { + $$parsedSource["B"] = $$createField0_0($$parsedSource["B"]); + } + return new StructA(/** @type {Partial} */($$parsedSource)); + } +} + +export class StructC { + /** + * Creates a new StructC instance. + * @param {Partial} [$$source = {}] - The source object to create the StructC. + */ + constructor($$source = {}) { + if (!("D" in $$source)) { + /** + * @member + * @type {structD} + */ + this["D"] = (new structD()); + } + + Object.assign(this, $$source); + } + + /** + * Creates a new StructC instance from a string or object. + * @param {any} [$$source = {}] + * @returns {StructC} + */ + static createFrom($$source = {}) { + const $$createField0_0 = $$createType2; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("D" in $$parsedSource) { + $$parsedSource["D"] = $$createField0_0($$parsedSource["D"]); + } + return new StructC(/** @type {Partial} */($$parsedSource)); + } +} + +export class StructE { + /** + * Creates a new StructE instance. + * @param {Partial} [$$source = {}] - The source object to create the StructE. + */ + constructor($$source = {}) { + + Object.assign(this, $$source); + } + + /** + * Creates a new StructE instance from a string or object. + * @param {any} [$$source = {}] + * @returns {StructE} + */ + static createFrom($$source = {}) { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new StructE(/** @type {Partial} */($$parsedSource)); + } +} + +export class structB { + /** + * Creates a new structB instance. + * @param {Partial} [$$source = {}] - The source object to create the structB. + */ + constructor($$source = {}) { + if (!("A" in $$source)) { + /** + * @member + * @type {StructA | null} + */ + this["A"] = null; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new structB instance from a string or object. + * @param {any} [$$source = {}] + * @returns {structB} + */ + static createFrom($$source = {}) { + const $$createField0_0 = $$createType4; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("A" in $$parsedSource) { + $$parsedSource["A"] = $$createField0_0($$parsedSource["A"]); + } + return new structB(/** @type {Partial} */($$parsedSource)); + } +} + +export class structD { + /** + * Creates a new structD instance. + * @param {Partial} [$$source = {}] - The source object to create the structD. + */ + constructor($$source = {}) { + if (!("E" in $$source)) { + /** + * @member + * @type {StructE} + */ + this["E"] = (new StructE()); + } + + Object.assign(this, $$source); + } + + /** + * Creates a new structD instance from a string or object. + * @param {any} [$$source = {}] + * @returns {structD} + */ + static createFrom($$source = {}) { + const $$createField0_0 = $$createType5; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("E" in $$parsedSource) { + $$parsedSource["E"] = $$createField0_0($$parsedSource["E"]); + } + return new structD(/** @type {Partial} */($$parsedSource)); + } +} + +// Private type creation functions +const $$createType0 = structB.createFrom; +const $$createType1 = $Create.Nullable($$createType0); +const $$createType2 = structD.createFrom; +const $$createType3 = StructA.createFrom; +const $$createType4 = $Create.Nullable($$createType3); +const $$createType5 = StructE.createFrom; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/models.js new file mode 100644 index 00000000000..7978fe3d88d --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/models.js @@ -0,0 +1,9 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +export { + StructA, + StructC, + StructE +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/greetservice.js similarity index 98% rename from v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/greetservice.js rename to v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/greetservice.js index 1880b7b2300..a255fb5939f 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/greetservice.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/greetservice.js @@ -13,7 +13,7 @@ import {Call as $Call, Create as $Create} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Make a cycle. diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/index.js similarity index 100% rename from v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/index.js rename to v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/index.js diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/internal.js similarity index 100% rename from v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/models.js rename to v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/internal.js diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/models.js new file mode 100644 index 00000000000..1d70efd7035 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/models.js @@ -0,0 +1,18 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as $models from "./internal.js"; + +/** + * @typedef {$models.Alias} Alias + */ + +/** + * @typedef {$models.Cyclic} Cyclic + */ + +/** + * @template T + * @typedef {$models.GenericCyclic} GenericCyclic + */ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/greetservice.js index 47ca987a9d3..f1d753078d1 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/greetservice.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/greetservice.js @@ -13,7 +13,7 @@ import {Call as $Call, Create as $Create} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Greet does XYZ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/internal.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/internal.js new file mode 100644 index 00000000000..1ddcaf0e031 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/internal.js @@ -0,0 +1,66 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Create as $Create} from "/wails/runtime.js"; + +/** + * Person represents a person + */ +export class Person { + /** + * Creates a new Person instance. + * @param {Partial} [$$source = {}] - The source object to create the Person. + */ + constructor($$source = {}) { + if (!("Title" in $$source)) { + /** + * @member + * @type {Title} + */ + this["Title"] = (/** @type {Title} */("")); + } + if (!("Name" in $$source)) { + /** + * @member + * @type {string} + */ + this["Name"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + * @param {any} [$$source = {}] + * @returns {Person} + */ + static createFrom($$source = {}) { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new Person(/** @type {Partial} */($$parsedSource)); + } +} + +/** + * Title is a title + * @readonly + * @enum {string} + */ +export const Title = { + /** + * The Go zero value for the underlying type of the enum. + */ + $zero: "", + + /** + * Mister is a title + */ + Mister: "Mr", + Miss: "Miss", + Ms: "Ms", + Mrs: "Mrs", + Dr: "Dr", +}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/models.js index 1ddcaf0e031..25b4a5f6550 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/models.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/models.js @@ -2,65 +2,7 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import {Create as $Create} from "/wails/runtime.js"; - -/** - * Person represents a person - */ -export class Person { - /** - * Creates a new Person instance. - * @param {Partial} [$$source = {}] - The source object to create the Person. - */ - constructor($$source = {}) { - if (!("Title" in $$source)) { - /** - * @member - * @type {Title} - */ - this["Title"] = (/** @type {Title} */("")); - } - if (!("Name" in $$source)) { - /** - * @member - * @type {string} - */ - this["Name"] = ""; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new Person instance from a string or object. - * @param {any} [$$source = {}] - * @returns {Person} - */ - static createFrom($$source = {}) { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - return new Person(/** @type {Partial} */($$parsedSource)); - } -} - -/** - * Title is a title - * @readonly - * @enum {string} - */ -export const Title = { - /** - * The Go zero value for the underlying type of the enum. - */ - $zero: "", - - /** - * Mister is a title - */ - Mister: "Mr", - Miss: "Miss", - Ms: "Ms", - Mrs: "Mrs", - Dr: "Dr", -}; +export { + Person, + Title +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/internal.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/internal.js new file mode 100644 index 00000000000..0e7acabe2ad --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/internal.js @@ -0,0 +1,27 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Create as $Create} from "/wails/runtime.js"; + +/** + * @readonly + * @enum {string} + */ +export const Title = { + /** + * The Go zero value for the underlying type of the enum. + */ + $zero: "", + + /** + * Mister is a title + */ + Mister: "Mr", + Miss: "Miss", + Ms: "Ms", + Mrs: "Mrs", + Dr: "Dr", +}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/models.js index 0e7acabe2ad..389f670e2bf 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/models.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/models.js @@ -2,26 +2,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import {Create as $Create} from "/wails/runtime.js"; - -/** - * @readonly - * @enum {string} - */ -export const Title = { - /** - * The Go zero value for the underlying type of the enum. - */ - $zero: "", - - /** - * Mister is a title - */ - Mister: "Mr", - Miss: "Miss", - Ms: "Ms", - Mrs: "Mrs", - Dr: "Dr", -}; +export { + Title +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/greetservice.js index 0ed0e3660f0..970e10385d6 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/greetservice.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/greetservice.js @@ -13,7 +13,7 @@ import {Call as $Call, Create as $Create} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Greet does XYZ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/internal.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/internal.js new file mode 100644 index 00000000000..8609395634e --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/internal.js @@ -0,0 +1,57 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Create as $Create} from "/wails/runtime.js"; + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import * as services$0 from "./services/models.js"; + +/** + * Person is a person + */ +export class Person { + /** + * Creates a new Person instance. + * @param {Partial} [$$source = {}] - The source object to create the Person. + */ + constructor($$source = {}) { + if (!("Name" in $$source)) { + /** + * @member + * @type {string} + */ + this["Name"] = ""; + } + if (!("Address" in $$source)) { + /** + * @member + * @type {services$0.Address | null} + */ + this["Address"] = null; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + * @param {any} [$$source = {}] + * @returns {Person} + */ + static createFrom($$source = {}) { + const $$createField1_0 = $$createType1; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Address" in $$parsedSource) { + $$parsedSource["Address"] = $$createField1_0($$parsedSource["Address"]); + } + return new Person(/** @type {Partial} */($$parsedSource)); + } +} + +// Private type creation functions +const $$createType0 = services$0.Address.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/models.js index 8609395634e..1cf2e24188a 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/models.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/models.js @@ -2,56 +2,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import {Create as $Create} from "/wails/runtime.js"; - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as services$0 from "./services/models.js"; - -/** - * Person is a person - */ -export class Person { - /** - * Creates a new Person instance. - * @param {Partial} [$$source = {}] - The source object to create the Person. - */ - constructor($$source = {}) { - if (!("Name" in $$source)) { - /** - * @member - * @type {string} - */ - this["Name"] = ""; - } - if (!("Address" in $$source)) { - /** - * @member - * @type {services$0.Address | null} - */ - this["Address"] = null; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new Person instance from a string or object. - * @param {any} [$$source = {}] - * @returns {Person} - */ - static createFrom($$source = {}) { - const $$createField1_0 = $$createType1; - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - if ("Address" in $$parsedSource) { - $$parsedSource["Address"] = $$createField1_0($$parsedSource["Address"]); - } - return new Person(/** @type {Partial} */($$parsedSource)); - } -} - -// Private type creation functions -const $$createType0 = services$0.Address.createFrom; -const $$createType1 = $Create.Nullable($$createType0); +export { + Person +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/internal.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/internal.js new file mode 100644 index 00000000000..fb1176deece --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/internal.js @@ -0,0 +1,49 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Create as $Create} from "/wails/runtime.js"; + +export class Address { + /** + * Creates a new Address instance. + * @param {Partial
} [$$source = {}] - The source object to create the Address. + */ + constructor($$source = {}) { + if (!("Street" in $$source)) { + /** + * @member + * @type {string} + */ + this["Street"] = ""; + } + if (!("State" in $$source)) { + /** + * @member + * @type {string} + */ + this["State"] = ""; + } + if (!("Country" in $$source)) { + /** + * @member + * @type {string} + */ + this["Country"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Address instance from a string or object. + * @param {any} [$$source = {}] + * @returns {Address} + */ + static createFrom($$source = {}) { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new Address(/** @type {Partial
} */($$parsedSource)); + } +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/models.js index fb1176deece..6820003a0c3 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/models.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/models.js @@ -2,48 +2,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import {Create as $Create} from "/wails/runtime.js"; - -export class Address { - /** - * Creates a new Address instance. - * @param {Partial
} [$$source = {}] - The source object to create the Address. - */ - constructor($$source = {}) { - if (!("Street" in $$source)) { - /** - * @member - * @type {string} - */ - this["Street"] = ""; - } - if (!("State" in $$source)) { - /** - * @member - * @type {string} - */ - this["State"] = ""; - } - if (!("Country" in $$source)) { - /** - * @member - * @type {string} - */ - this["Country"] = ""; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new Address instance from a string or object. - * @param {any} [$$source = {}] - * @returns {Address} - */ - static createFrom($$source = {}) { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - return new Address(/** @type {Partial
} */($$parsedSource)); - } -} +export { + Address +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/otherservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/otherservice.js index 7426508f7c5..0b08f6e209c 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/otherservice.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/otherservice.js @@ -14,7 +14,7 @@ import {Call as $Call, Create as $Create} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Yay does this and that diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/greetservice.js index 0ed0e3660f0..970e10385d6 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/greetservice.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/greetservice.js @@ -13,7 +13,7 @@ import {Call as $Call, Create as $Create} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Greet does XYZ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/internal.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/internal.js new file mode 100644 index 00000000000..5b28ee2f662 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/internal.js @@ -0,0 +1,54 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Create as $Create} from "/wails/runtime.js"; + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import * as other$0 from "./services/other/models.js"; + +export class Person { + /** + * Creates a new Person instance. + * @param {Partial} [$$source = {}] - The source object to create the Person. + */ + constructor($$source = {}) { + if (!("Name" in $$source)) { + /** + * @member + * @type {string} + */ + this["Name"] = ""; + } + if (!("Address" in $$source)) { + /** + * @member + * @type {other$0.Address | null} + */ + this["Address"] = null; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + * @param {any} [$$source = {}] + * @returns {Person} + */ + static createFrom($$source = {}) { + const $$createField1_0 = $$createType1; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Address" in $$parsedSource) { + $$parsedSource["Address"] = $$createField1_0($$parsedSource["Address"]); + } + return new Person(/** @type {Partial} */($$parsedSource)); + } +} + +// Private type creation functions +const $$createType0 = other$0.Address.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/models.js index 5b28ee2f662..1cf2e24188a 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/models.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/models.js @@ -2,53 +2,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import {Create as $Create} from "/wails/runtime.js"; - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as other$0 from "./services/other/models.js"; - -export class Person { - /** - * Creates a new Person instance. - * @param {Partial} [$$source = {}] - The source object to create the Person. - */ - constructor($$source = {}) { - if (!("Name" in $$source)) { - /** - * @member - * @type {string} - */ - this["Name"] = ""; - } - if (!("Address" in $$source)) { - /** - * @member - * @type {other$0.Address | null} - */ - this["Address"] = null; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new Person instance from a string or object. - * @param {any} [$$source = {}] - * @returns {Person} - */ - static createFrom($$source = {}) { - const $$createField1_0 = $$createType1; - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - if ("Address" in $$parsedSource) { - $$parsedSource["Address"] = $$createField1_0($$parsedSource["Address"]); - } - return new Person(/** @type {Partial} */($$parsedSource)); - } -} - -// Private type creation functions -const $$createType0 = other$0.Address.createFrom; -const $$createType1 = $Create.Nullable($$createType0); +export { + Person +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/internal.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/internal.js new file mode 100644 index 00000000000..fb1176deece --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/internal.js @@ -0,0 +1,49 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Create as $Create} from "/wails/runtime.js"; + +export class Address { + /** + * Creates a new Address instance. + * @param {Partial
} [$$source = {}] - The source object to create the Address. + */ + constructor($$source = {}) { + if (!("Street" in $$source)) { + /** + * @member + * @type {string} + */ + this["Street"] = ""; + } + if (!("State" in $$source)) { + /** + * @member + * @type {string} + */ + this["State"] = ""; + } + if (!("Country" in $$source)) { + /** + * @member + * @type {string} + */ + this["Country"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Address instance from a string or object. + * @param {any} [$$source = {}] + * @returns {Address} + */ + static createFrom($$source = {}) { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new Address(/** @type {Partial
} */($$parsedSource)); + } +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/models.js index fb1176deece..6820003a0c3 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/models.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/models.js @@ -2,48 +2,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import {Create as $Create} from "/wails/runtime.js"; - -export class Address { - /** - * Creates a new Address instance. - * @param {Partial
} [$$source = {}] - The source object to create the Address. - */ - constructor($$source = {}) { - if (!("Street" in $$source)) { - /** - * @member - * @type {string} - */ - this["Street"] = ""; - } - if (!("State" in $$source)) { - /** - * @member - * @type {string} - */ - this["State"] = ""; - } - if (!("Country" in $$source)) { - /** - * @member - * @type {string} - */ - this["Country"] = ""; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new Address instance from a string or object. - * @param {any} [$$source = {}] - * @returns {Address} - */ - static createFrom($$source = {}) { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - return new Address(/** @type {Partial
} */($$parsedSource)); - } -} +export { + Address +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/otherservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/otherservice.js index d01fa13f6d2..8e1edb9717b 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/otherservice.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/otherservice.js @@ -14,7 +14,7 @@ import {Call as $Call, Create as $Create} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Yay does this and that diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_internal/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_internal/greetservice.js new file mode 100644 index 00000000000..83b635bea68 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_internal/greetservice.js @@ -0,0 +1,22 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * Greet someone + * @param {string} name + * @returns {Promise & { cancel(): void }} + */ +export function Greet(name) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Greet", name)); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_internal/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_internal/index.js new file mode 100644 index 00000000000..fdf1ff435a9 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_internal/index.js @@ -0,0 +1,8 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/internal.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/internal.js index ec8a847eb33..d09e0de6adf 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/internal.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/internal.js @@ -6,6 +6,115 @@ // @ts-ignore: Unused imports import {Create as $Create} from "/wails/runtime.js"; +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import * as other$0 from "./other/models.js"; + +/** + * HowDifferent is a curious kind of person + * that lets other people decide how they are different. + * @template How + */ +export class HowDifferent { + /** + * Creates a new HowDifferent instance. + * @param {Partial>} [$$source = {}] - The source object to create the HowDifferent. + */ + constructor($$source = {}) { + if (!("Name" in $$source)) { + /** + * They have a name as well. + * @member + * @type {string} + */ + this["Name"] = ""; + } + if (!("Differences" in $$source)) { + /** + * But they may have many differences. + * @member + * @type {{ [_: string]: How | null }[]} + */ + this["Differences"] = []; + } + + Object.assign(this, $$source); + } + + /** + * Given creation functions for each type parameter, + * returns a creation function for a concrete instance + * of the generic class HowDifferent. + * @template How + * @param {(source: any) => How} $$createParamHow + * @returns {($$source?: any) => HowDifferent} + */ + static createFrom($$createParamHow) { + const $$createField1_0 = $$createType1($$createParamHow); + return ($$source = {}) => { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Differences" in $$parsedSource) { + $$parsedSource["Differences"] = $$createField1_0($$parsedSource["Differences"]); + } + return new HowDifferent(/** @type {Partial>} */($$parsedSource)); + }; + } +} + +/** + * Impersonator gets their fields from other people. + */ +export const Impersonator = other$0.OtherPerson; + +/** + * Impersonator gets their fields from other people. + * @typedef {other$0.OtherPerson} Impersonator + */ + +/** + * Person is not a number. + */ +export class Person { + /** + * Creates a new Person instance. + * @param {Partial} [$$source = {}] - The source object to create the Person. + */ + constructor($$source = {}) { + if (!("Name" in $$source)) { + /** + * They have a name. + * @member + * @type {string} + */ + this["Name"] = ""; + } + if (!("Friends" in $$source)) { + /** + * Exactly 4 sketchy friends. + * @member + * @type {Impersonator[]} + */ + this["Friends"] = Array.from({ length: 4 }, () => (new Impersonator())); + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + * @param {any} [$$source = {}] + * @returns {Person} + */ + static createFrom($$source = {}) { + const $$createField1_0 = $$createType3; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Friends" in $$parsedSource) { + $$parsedSource["Friends"] = $$createField1_0($$parsedSource["Friends"]); + } + return new Person(/** @type {Partial} */($$parsedSource)); + } +} + export class personImpl { /** * Creates a new personImpl instance. @@ -28,6 +137,14 @@ export class personImpl { */ this["Name"] = ""; } + if (!("Friends" in $$source)) { + /** + * Exactly 4 sketchy friends. + * @member + * @type {Impersonator[]} + */ + this["Friends"] = Array.from({ length: 4 }, () => (new Impersonator())); + } Object.assign(this, $$source); } @@ -38,7 +155,27 @@ export class personImpl { * @returns {personImpl} */ static createFrom($$source = {}) { + const $$createField2_0 = $$createType3; let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Friends" in $$parsedSource) { + $$parsedSource["Friends"] = $$createField2_0($$parsedSource["Friends"]); + } return new personImpl(/** @type {Partial} */($$parsedSource)); } } + +/** + * PrivatePerson gets their fields from hidden sources. + */ +export const PrivatePerson = personImpl; + +/** + * PrivatePerson gets their fields from hidden sources. + * @typedef {personImpl} PrivatePerson + */ + +// Private type creation functions +const $$createType0 = ($$createParamHow) => $Create.Map($Create.Any, $$createParamHow); +const $$createType1 = ($$createParamHow) => $Create.Array($$createType0($$createParamHow)); +const $$createType2 = Impersonator.createFrom; +const $$createType3 = $Create.Array($$createType2); diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/models.js index e4c9b35a147..1515d48ea41 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/models.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/models.js @@ -2,121 +2,9 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import {Create as $Create} from "/wails/runtime.js"; - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as other$0 from "./other/models.js"; - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as $internal from "./internal.js"; - -/** - * HowDifferent is a curious kind of person - * that lets other people decide how they are different. - * @template How - */ -export class HowDifferent { - /** - * Creates a new HowDifferent instance. - * @param {Partial>} [$$source = {}] - The source object to create the HowDifferent. - */ - constructor($$source = {}) { - if (!("Name" in $$source)) { - /** - * They have a name as well. - * @member - * @type {string} - */ - this["Name"] = ""; - } - if (!("Differences" in $$source)) { - /** - * But they may have many differences. - * @member - * @type {{ [_: string]: How | null }[]} - */ - this["Differences"] = []; - } - - Object.assign(this, $$source); - } - - /** - * Given creation functions for each type parameter, - * returns a creation function for a concrete instance - * of the generic class HowDifferent. - * @template How - * @param {(source: any) => How} $$createParamHow - * @returns {($$source?: any) => HowDifferent} - */ - static createFrom($$createParamHow) { - const $$createField1_0 = $$createType1($$createParamHow); - return ($$source = {}) => { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - if ("Differences" in $$parsedSource) { - $$parsedSource["Differences"] = $$createField1_0($$parsedSource["Differences"]); - } - return new HowDifferent(/** @type {Partial>} */($$parsedSource)); - }; - } -} - -/** - * Impersonator gets their fields from other people. - */ -export const Impersonator = other$0.OtherPerson; - -/** - * Impersonator gets their fields from other people. - * @typedef {other$0.OtherPerson} Impersonator - */ - -/** - * Person is not a number. - */ -export class Person { - /** - * Creates a new Person instance. - * @param {Partial} [$$source = {}] - The source object to create the Person. - */ - constructor($$source = {}) { - if (!("Name" in $$source)) { - /** - * They have a name. - * @member - * @type {string} - */ - this["Name"] = ""; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new Person instance from a string or object. - * @param {any} [$$source = {}] - * @returns {Person} - */ - static createFrom($$source = {}) { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - return new Person(/** @type {Partial} */($$parsedSource)); - } -} - -/** - * PrivatePerson gets their fields from hidden sources. - */ -export const PrivatePerson = $internal.personImpl; - -/** - * PrivatePerson gets their fields from hidden sources. - * @typedef {$internal.personImpl} PrivatePerson - */ - -// Private type creation functions -const $$createType0 = ($$createParamHow) => $Create.Map($Create.Any, $$createParamHow); -const $$createType1 = ($$createParamHow) => $Create.Array($$createType0($$createParamHow)); +export { + HowDifferent, + Impersonator, + Person, + PrivatePerson +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/internal.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/internal.js new file mode 100644 index 00000000000..455e369fc11 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/internal.js @@ -0,0 +1,60 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Create as $Create} from "/wails/runtime.js"; + +/** + * OtherPerson is like a person, but different. + * @template T + */ +export class OtherPerson { + /** + * Creates a new OtherPerson instance. + * @param {Partial>} [$$source = {}] - The source object to create the OtherPerson. + */ + constructor($$source = {}) { + if (!("Name" in $$source)) { + /** + * They have a name as well. + * @member + * @type {string} + */ + this["Name"] = ""; + } + if (!("Differences" in $$source)) { + /** + * But they may have many differences. + * @member + * @type {(T | null)[]} + */ + this["Differences"] = []; + } + + Object.assign(this, $$source); + } + + /** + * Given creation functions for each type parameter, + * returns a creation function for a concrete instance + * of the generic class OtherPerson. + * @template T + * @param {(source: any) => T} $$createParamT + * @returns {($$source?: any) => OtherPerson} + */ + static createFrom($$createParamT) { + const $$createField1_0 = $$createType0($$createParamT); + return ($$source = {}) => { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Differences" in $$parsedSource) { + $$parsedSource["Differences"] = $$createField1_0($$parsedSource["Differences"]); + } + return new OtherPerson(/** @type {Partial>} */($$parsedSource)); + }; + } +} + +// Private type creation functions +const $$createType0 = ($$createParamT) => $Create.Array($$createParamT); diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/models.js index 455e369fc11..30bb60b19ed 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/models.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/models.js @@ -2,59 +2,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import {Create as $Create} from "/wails/runtime.js"; - -/** - * OtherPerson is like a person, but different. - * @template T - */ -export class OtherPerson { - /** - * Creates a new OtherPerson instance. - * @param {Partial>} [$$source = {}] - The source object to create the OtherPerson. - */ - constructor($$source = {}) { - if (!("Name" in $$source)) { - /** - * They have a name as well. - * @member - * @type {string} - */ - this["Name"] = ""; - } - if (!("Differences" in $$source)) { - /** - * But they may have many differences. - * @member - * @type {(T | null)[]} - */ - this["Differences"] = []; - } - - Object.assign(this, $$source); - } - - /** - * Given creation functions for each type parameter, - * returns a creation function for a concrete instance - * of the generic class OtherPerson. - * @template T - * @param {(source: any) => T} $$createParamT - * @returns {($$source?: any) => OtherPerson} - */ - static createFrom($$createParamT) { - const $$createField1_0 = $$createType0($$createParamT); - return ($$source = {}) => { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - if ("Differences" in $$parsedSource) { - $$parsedSource["Differences"] = $$createField1_0($$parsedSource["Differences"]); - } - return new OtherPerson(/** @type {Partial>} */($$parsedSource)); - }; - } -} - -// Private type creation functions -const $$createType0 = ($$createParamT) => $Create.Array($$createParamT); +export { + OtherPerson +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/somemethods.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/somemethods.js index d1dc635bd7d..36c192f78b3 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/somemethods.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/somemethods.js @@ -13,11 +13,11 @@ import {Call as $Call, Create as $Create} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * LikeThisOne is an example method that does nothing. - * @returns {Promise<[$models.Person, $models.Impersonator, $models.HowDifferent, $models.PrivatePerson]> & { cancel(): void }} + * @returns {Promise<[$models.Person, $models.HowDifferent, $models.PrivatePerson]> & { cancel(): void }} */ export function LikeThisOne() { let $resultPromise = /** @type {any} */($Call.ByName("github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here.SomeMethods.LikeThisOne")); @@ -25,7 +25,6 @@ export function LikeThisOne() { $result[0] = $$createType0($result[0]); $result[1] = $$createType1($result[1]); $result[2] = $$createType2($result[2]); - $result[3] = $$createType3($result[3]); return $result; })); $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); @@ -43,6 +42,5 @@ export function LikeThisOtherOne() { // Private type creation functions const $$createType0 = $models.Person.createFrom; -const $$createType1 = $models.Impersonator.createFrom; -const $$createType2 = $models.HowDifferent.createFrom($Create.Any); -const $$createType3 = $models.PrivatePerson.createFrom; +const $$createType1 = $models.HowDifferent.createFrom($Create.Any); +const $$createType2 = $models.PrivatePerson.createFrom; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/embedservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/embedservice.js index 81a3f4a5b53..e33c3c86dd7 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/embedservice.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/embedservice.js @@ -17,7 +17,7 @@ import * as nobindingshere$0 from "../no_bindings_here/models.js"; /** * LikeThisOne is an example method that does nothing. - * @returns {Promise<[nobindingshere$0.Person, nobindingshere$0.Impersonator, nobindingshere$0.HowDifferent, nobindingshere$0.PrivatePerson]> & { cancel(): void }} + * @returns {Promise<[nobindingshere$0.Person, nobindingshere$0.HowDifferent, nobindingshere$0.PrivatePerson]> & { cancel(): void }} */ export function LikeThisOne() { let $resultPromise = /** @type {any} */($Call.ByName("main.EmbedService.LikeThisOne")); @@ -25,7 +25,6 @@ export function LikeThisOne() { $result[0] = $$createType0($result[0]); $result[1] = $$createType1($result[1]); $result[2] = $$createType2($result[2]); - $result[3] = $$createType3($result[3]); return $result; })); $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); @@ -43,6 +42,5 @@ export function LikeThisOtherOne() { // Private type creation functions const $$createType0 = nobindingshere$0.Person.createFrom; -const $$createType1 = nobindingshere$0.Impersonator.createFrom; -const $$createType2 = nobindingshere$0.HowDifferent.createFrom($Create.Any); -const $$createType3 = nobindingshere$0.PrivatePerson.createFrom; +const $$createType1 = nobindingshere$0.HowDifferent.createFrom($Create.Any); +const $$createType2 = nobindingshere$0.PrivatePerson.createFrom; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/greetservice.js index 0ed0e3660f0..970e10385d6 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/greetservice.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/greetservice.js @@ -13,7 +13,7 @@ import {Call as $Call, Create as $Create} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Greet does XYZ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/internal.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/internal.js new file mode 100644 index 00000000000..e187cce2235 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/internal.js @@ -0,0 +1,54 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Create as $Create} from "/wails/runtime.js"; + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import * as services$0 from "./services/models.js"; + +export class Person { + /** + * Creates a new Person instance. + * @param {Partial} [$$source = {}] - The source object to create the Person. + */ + constructor($$source = {}) { + if (!("Name" in $$source)) { + /** + * @member + * @type {string} + */ + this["Name"] = ""; + } + if (!("Address" in $$source)) { + /** + * @member + * @type {services$0.Address | null} + */ + this["Address"] = null; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + * @param {any} [$$source = {}] + * @returns {Person} + */ + static createFrom($$source = {}) { + const $$createField1_0 = $$createType1; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Address" in $$parsedSource) { + $$parsedSource["Address"] = $$createField1_0($$parsedSource["Address"]); + } + return new Person(/** @type {Partial} */($$parsedSource)); + } +} + +// Private type creation functions +const $$createType0 = services$0.Address.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/models.js index e187cce2235..1cf2e24188a 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/models.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/models.js @@ -2,53 +2,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import {Create as $Create} from "/wails/runtime.js"; - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as services$0 from "./services/models.js"; - -export class Person { - /** - * Creates a new Person instance. - * @param {Partial} [$$source = {}] - The source object to create the Person. - */ - constructor($$source = {}) { - if (!("Name" in $$source)) { - /** - * @member - * @type {string} - */ - this["Name"] = ""; - } - if (!("Address" in $$source)) { - /** - * @member - * @type {services$0.Address | null} - */ - this["Address"] = null; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new Person instance from a string or object. - * @param {any} [$$source = {}] - * @returns {Person} - */ - static createFrom($$source = {}) { - const $$createField1_0 = $$createType1; - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - if ("Address" in $$parsedSource) { - $$parsedSource["Address"] = $$createField1_0($$parsedSource["Address"]); - } - return new Person(/** @type {Partial} */($$parsedSource)); - } -} - -// Private type creation functions -const $$createType0 = services$0.Address.createFrom; -const $$createType1 = $Create.Nullable($$createType0); +export { + Person +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/internal.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/internal.js new file mode 100644 index 00000000000..fb1176deece --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/internal.js @@ -0,0 +1,49 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Create as $Create} from "/wails/runtime.js"; + +export class Address { + /** + * Creates a new Address instance. + * @param {Partial
} [$$source = {}] - The source object to create the Address. + */ + constructor($$source = {}) { + if (!("Street" in $$source)) { + /** + * @member + * @type {string} + */ + this["Street"] = ""; + } + if (!("State" in $$source)) { + /** + * @member + * @type {string} + */ + this["State"] = ""; + } + if (!("Country" in $$source)) { + /** + * @member + * @type {string} + */ + this["Country"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Address instance from a string or object. + * @param {any} [$$source = {}] + * @returns {Address} + */ + static createFrom($$source = {}) { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new Address(/** @type {Partial
} */($$parsedSource)); + } +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/models.js index fb1176deece..6820003a0c3 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/models.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/models.js @@ -2,48 +2,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import {Create as $Create} from "/wails/runtime.js"; - -export class Address { - /** - * Creates a new Address instance. - * @param {Partial
} [$$source = {}] - The source object to create the Address. - */ - constructor($$source = {}) { - if (!("Street" in $$source)) { - /** - * @member - * @type {string} - */ - this["Street"] = ""; - } - if (!("State" in $$source)) { - /** - * @member - * @type {string} - */ - this["State"] = ""; - } - if (!("Country" in $$source)) { - /** - * @member - * @type {string} - */ - this["Country"] = ""; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new Address instance from a string or object. - * @param {any} [$$source = {}] - * @returns {Address} - */ - static createFrom($$source = {}) { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - return new Address(/** @type {Partial
} */($$parsedSource)); - } -} +export { + Address +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/otherservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/otherservice.js index 105fc3ea8a6..633e8136cb7 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/otherservice.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/otherservice.js @@ -14,7 +14,7 @@ import {Call as $Call, Create as $Create} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Yay does this and that diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/greetservice.js index f637bdbd404..199f35a35ba 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/greetservice.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/greetservice.js @@ -13,7 +13,7 @@ import {Call as $Call, Create as $Create} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * @param {number[]} $in diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/internal.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/internal.js new file mode 100644 index 00000000000..660f38b29f0 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/internal.js @@ -0,0 +1,57 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Create as $Create} from "/wails/runtime.js"; + +export class Person { + /** + * Creates a new Person instance. + * @param {Partial} [$$source = {}] - The source object to create the Person. + */ + constructor($$source = {}) { + if (!("Name" in $$source)) { + /** + * @member + * @type {string} + */ + this["Name"] = ""; + } + if (!("Parent" in $$source)) { + /** + * @member + * @type {Person | null} + */ + this["Parent"] = null; + } + if (!("Details" in $$source)) { + /** + * @member + * @type {{"Age": number, "Address": {"Street": string}}} + */ + this["Details"] = {"Age": 0, "Address": {"Street": ""}}; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + * @param {any} [$$source = {}] + * @returns {Person} + */ + static createFrom($$source = {}) { + const $$createField1_0 = $$createType1; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Parent" in $$parsedSource) { + $$parsedSource["Parent"] = $$createField1_0($$parsedSource["Parent"]); + } + return new Person(/** @type {Partial} */($$parsedSource)); + } +} + +// Private type creation functions +const $$createType0 = Person.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/models.js index 660f38b29f0..1cf2e24188a 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/models.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/models.js @@ -2,56 +2,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import {Create as $Create} from "/wails/runtime.js"; - -export class Person { - /** - * Creates a new Person instance. - * @param {Partial} [$$source = {}] - The source object to create the Person. - */ - constructor($$source = {}) { - if (!("Name" in $$source)) { - /** - * @member - * @type {string} - */ - this["Name"] = ""; - } - if (!("Parent" in $$source)) { - /** - * @member - * @type {Person | null} - */ - this["Parent"] = null; - } - if (!("Details" in $$source)) { - /** - * @member - * @type {{"Age": number, "Address": {"Street": string}}} - */ - this["Details"] = {"Age": 0, "Address": {"Street": ""}}; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new Person instance from a string or object. - * @param {any} [$$source = {}] - * @returns {Person} - */ - static createFrom($$source = {}) { - const $$createField1_0 = $$createType1; - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - if ("Parent" in $$parsedSource) { - $$parsedSource["Parent"] = $$createField1_0($$parsedSource["Parent"]); - } - return new Person(/** @type {Partial} */($$parsedSource)); - } -} - -// Private type creation functions -const $$createType0 = Person.createFrom; -const $$createType1 = $Create.Nullable($$createType0); +export { + Person +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/greetservice.js index f637bdbd404..199f35a35ba 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/greetservice.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/greetservice.js @@ -13,7 +13,7 @@ import {Call as $Call, Create as $Create} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * @param {number[]} $in diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/internal.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/internal.js new file mode 100644 index 00000000000..660f38b29f0 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/internal.js @@ -0,0 +1,57 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Create as $Create} from "/wails/runtime.js"; + +export class Person { + /** + * Creates a new Person instance. + * @param {Partial} [$$source = {}] - The source object to create the Person. + */ + constructor($$source = {}) { + if (!("Name" in $$source)) { + /** + * @member + * @type {string} + */ + this["Name"] = ""; + } + if (!("Parent" in $$source)) { + /** + * @member + * @type {Person | null} + */ + this["Parent"] = null; + } + if (!("Details" in $$source)) { + /** + * @member + * @type {{"Age": number, "Address": {"Street": string}}} + */ + this["Details"] = {"Age": 0, "Address": {"Street": ""}}; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + * @param {any} [$$source = {}] + * @returns {Person} + */ + static createFrom($$source = {}) { + const $$createField1_0 = $$createType1; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Parent" in $$parsedSource) { + $$parsedSource["Parent"] = $$createField1_0($$parsedSource["Parent"]); + } + return new Person(/** @type {Partial} */($$parsedSource)); + } +} + +// Private type creation functions +const $$createType0 = Person.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/models.js index 660f38b29f0..1cf2e24188a 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/models.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/models.js @@ -2,56 +2,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import {Create as $Create} from "/wails/runtime.js"; - -export class Person { - /** - * Creates a new Person instance. - * @param {Partial} [$$source = {}] - The source object to create the Person. - */ - constructor($$source = {}) { - if (!("Name" in $$source)) { - /** - * @member - * @type {string} - */ - this["Name"] = ""; - } - if (!("Parent" in $$source)) { - /** - * @member - * @type {Person | null} - */ - this["Parent"] = null; - } - if (!("Details" in $$source)) { - /** - * @member - * @type {{"Age": number, "Address": {"Street": string}}} - */ - this["Details"] = {"Age": 0, "Address": {"Street": ""}}; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new Person instance from a string or object. - * @param {any} [$$source = {}] - * @returns {Person} - */ - static createFrom($$source = {}) { - const $$createField1_0 = $$createType1; - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - if ("Parent" in $$parsedSource) { - $$parsedSource["Parent"] = $$createField1_0($$parsedSource["Parent"]); - } - return new Person(/** @type {Partial} */($$parsedSource)); - } -} - -// Private type creation functions -const $$createType0 = Person.createFrom; -const $$createType1 = $Create.Nullable($$createType0); +export { + Person +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/greetservice.js index 0ed0e3660f0..970e10385d6 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/greetservice.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/greetservice.js @@ -13,7 +13,7 @@ import {Call as $Call, Create as $Create} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Greet does XYZ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/internal.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/internal.js new file mode 100644 index 00000000000..0daca427b60 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/internal.js @@ -0,0 +1,58 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Create as $Create} from "/wails/runtime.js"; + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import * as services$0 from "./services/models.js"; + +/** + * Person is a person! + * They have a name and an address + */ +export class Person { + /** + * Creates a new Person instance. + * @param {Partial} [$$source = {}] - The source object to create the Person. + */ + constructor($$source = {}) { + if (!("Name" in $$source)) { + /** + * @member + * @type {string} + */ + this["Name"] = ""; + } + if (!("Address" in $$source)) { + /** + * @member + * @type {services$0.Address | null} + */ + this["Address"] = null; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + * @param {any} [$$source = {}] + * @returns {Person} + */ + static createFrom($$source = {}) { + const $$createField1_0 = $$createType1; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Address" in $$parsedSource) { + $$parsedSource["Address"] = $$createField1_0($$parsedSource["Address"]); + } + return new Person(/** @type {Partial} */($$parsedSource)); + } +} + +// Private type creation functions +const $$createType0 = services$0.Address.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/models.js index 0daca427b60..1cf2e24188a 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/models.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/models.js @@ -2,57 +2,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import {Create as $Create} from "/wails/runtime.js"; - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as services$0 from "./services/models.js"; - -/** - * Person is a person! - * They have a name and an address - */ -export class Person { - /** - * Creates a new Person instance. - * @param {Partial} [$$source = {}] - The source object to create the Person. - */ - constructor($$source = {}) { - if (!("Name" in $$source)) { - /** - * @member - * @type {string} - */ - this["Name"] = ""; - } - if (!("Address" in $$source)) { - /** - * @member - * @type {services$0.Address | null} - */ - this["Address"] = null; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new Person instance from a string or object. - * @param {any} [$$source = {}] - * @returns {Person} - */ - static createFrom($$source = {}) { - const $$createField1_0 = $$createType1; - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - if ("Address" in $$parsedSource) { - $$parsedSource["Address"] = $$createField1_0($$parsedSource["Address"]); - } - return new Person(/** @type {Partial} */($$parsedSource)); - } -} - -// Private type creation functions -const $$createType0 = services$0.Address.createFrom; -const $$createType1 = $Create.Nullable($$createType0); +export { + Person +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/internal.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/internal.js new file mode 100644 index 00000000000..fb1176deece --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/internal.js @@ -0,0 +1,49 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Create as $Create} from "/wails/runtime.js"; + +export class Address { + /** + * Creates a new Address instance. + * @param {Partial
} [$$source = {}] - The source object to create the Address. + */ + constructor($$source = {}) { + if (!("Street" in $$source)) { + /** + * @member + * @type {string} + */ + this["Street"] = ""; + } + if (!("State" in $$source)) { + /** + * @member + * @type {string} + */ + this["State"] = ""; + } + if (!("Country" in $$source)) { + /** + * @member + * @type {string} + */ + this["Country"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Address instance from a string or object. + * @param {any} [$$source = {}] + * @returns {Address} + */ + static createFrom($$source = {}) { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new Address(/** @type {Partial
} */($$parsedSource)); + } +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/models.js index fb1176deece..6820003a0c3 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/models.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/models.js @@ -2,48 +2,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import {Create as $Create} from "/wails/runtime.js"; - -export class Address { - /** - * Creates a new Address instance. - * @param {Partial
} [$$source = {}] - The source object to create the Address. - */ - constructor($$source = {}) { - if (!("Street" in $$source)) { - /** - * @member - * @type {string} - */ - this["Street"] = ""; - } - if (!("State" in $$source)) { - /** - * @member - * @type {string} - */ - this["State"] = ""; - } - if (!("Country" in $$source)) { - /** - * @member - * @type {string} - */ - this["Country"] = ""; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new Address instance from a string or object. - * @param {any} [$$source = {}] - * @returns {Address} - */ - static createFrom($$source = {}) { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - return new Address(/** @type {Partial
} */($$parsedSource)); - } -} +export { + Address +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/otherservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/otherservice.js index 47ce5c70ae2..21bbc7aa0a4 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/otherservice.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/otherservice.js @@ -14,7 +14,7 @@ import {Call as $Call, Create as $Create} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Yay does this and that diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/greetservice.js index 9b6224fff1a..89ab39fad49 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/greetservice.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/greetservice.js @@ -13,10 +13,10 @@ import {Call as $Call} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** - * Get someone + * Get someone. * @param {$models.Alias} aliasValue * @returns {Promise<$models.Person> & { cancel(): void }} */ @@ -26,7 +26,17 @@ export function Get(aliasValue) { } /** - * Get someone quite different + * Apparently, aliases are all the rage right now. + * @param {$models.AliasedPerson} p + * @returns {Promise<$models.StrangelyAliasedPerson> & { cancel(): void }} + */ +export function GetButAliased(p) { + let $resultPromise = /** @type {any} */($Call.ByID(1896499664, p)); + return $resultPromise; +} + +/** + * Get someone quite different. * @returns {Promise<$models.GenericPerson> & { cancel(): void }} */ export function GetButDifferent() { diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/internal.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/internal.js new file mode 100644 index 00000000000..756c523b0ad --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/internal.js @@ -0,0 +1,65 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * A nice type Alias. + * @typedef {number} Alias + */ + +/** + * A struct alias. + * This should be rendered as a typedef or interface in every mode. + * @typedef {Object} AliasStruct + * @property {number[] | null} Foo - A field with a comment. + * @property {string} [Bar] - Definitely not Foo. + * @property {string} [Baz] - Definitely not Foo. + * @property {OtherAliasStruct} Other - A nested alias struct. + */ + +/** + * A class alias. + * @typedef {Person} AliasedPerson + */ + +/** + * An empty struct alias. + * @typedef { { + * } } EmptyAliasStruct + */ + +/** + * An empty struct. + * @typedef { { + * } } EmptyStruct + */ + +/** + * A generic struct containing an alias. + * @template T + * @typedef {Object} GenericPerson + * @property {T | null} Name + * @property {Alias} AliasedField + */ + +/** + * Another struct alias. + * @typedef {Object} OtherAliasStruct + * @property {number[] | null} NoMoreIdeas + */ + +/** + * A non-generic struct containing an alias. + * @typedef {Object} Person + * @property {string} Name - The Person's name. + * @property {Alias} AliasedField - A random alias field. + */ + +/** + * Another class alias, but ordered after its aliased class. + * @typedef {Person} StrangelyAliasedPerson + */ + +// In interface mode, this file is likely to contain just comments. +// We add a dummy export statement to ensure it is recognised as an ES module. +export {}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/models.js index dfcbbe91f58..bfecf2d1a3a 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/models.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/models.js @@ -2,55 +2,51 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** - * A nice type Alias - * @typedef {number} Alias + * A nice type Alias. + * @typedef {$models.Alias} Alias */ /** * A struct alias. * This should be rendered as a typedef or interface in every mode. - * @typedef {Object} AliasStruct - * @property {number[] | null} Foo - A field with a comment. - * @property {string} [Bar] - Definitely not Foo. - * @property {string} [Baz] - Definitely not Foo. - * @property {OtherAliasStruct} Other - A nested alias struct. + * @typedef {$models.AliasStruct} AliasStruct + */ + +/** + * A class alias. + * @typedef {$models.AliasedPerson} AliasedPerson */ /** * An empty struct alias. - * @typedef { { - * } } EmptyAliasStruct + * @typedef {$models.EmptyAliasStruct} EmptyAliasStruct */ /** * An empty struct. - * @typedef { { - * } } EmptyStruct + * @typedef {$models.EmptyStruct} EmptyStruct */ /** - * A generic struct containing an alias + * A generic struct containing an alias. * @template T - * @typedef {Object} GenericPerson - * @property {T | null} Name - * @property {Alias} AliasedField + * @typedef {$models.GenericPerson} GenericPerson */ /** * Another struct alias. - * @typedef {Object} OtherAliasStruct - * @property {number[] | null} NoMoreIdeas + * @typedef {$models.OtherAliasStruct} OtherAliasStruct */ /** * A non-generic struct containing an alias. - * @typedef {Object} Person - * @property {string} Name - The Person's name. - * @property {Alias} AliasedField - A random alias field. + * @typedef {$models.Person} Person + */ + +/** + * Another class alias, but ordered after its aliased class. + * @typedef {$models.StrangelyAliasedPerson} StrangelyAliasedPerson */ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/greetservice.js index c8cf7d8a434..859df0310f9 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/greetservice.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/greetservice.js @@ -13,7 +13,7 @@ import {Call as $Call} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Greet does XYZ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/internal.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/internal.js index deaa31ce4d4..b3063077765 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/internal.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/internal.js @@ -2,13 +2,63 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT +/** + * @typedef {Object} Embedded1 + * @property {number} Friends - Friends should be shadowed in Person by a field of lesser depth + * @property {number} Vanish - Vanish should be omitted from Person because there is another field with same depth and no tag + * @property {string} StillThere - StillThere should be shadowed in Person by other field with same depth and a json tag + * @property {`${boolean}`} NamingThingsIsHard - NamingThingsIsHard is a law of programming + */ -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as $models from "./models.js"; +/** + * @typedef {string} Embedded3 + */ + +/** + * Person represents a person + * @typedef { { + * "Titles"?: Title[] | null, + * "Names": string[] | null, + * "Partner": Person | null, + * "Friends": (Person | null)[] | null, + * "NamingThingsIsHard": `${boolean}`, + * "StillThere": Embedded3 | null, + * "-": number, + * "Embedded3": Embedded3, + * "StrangerNumber": `${number}`, + * "StrangestString"?: `"${string}"`, + * "StringStrangest"?: `"${string}"`, + * "emb4"?: embedded4, + * } } Person + */ + +/** + * Title is a title + * @readonly + * @enum {string} + */ +export const Title = { + /** + * The Go zero value for the underlying type of the enum. + */ + $zero: "", + + /** + * Mister is a title + */ + Mister: "Mr", + Miss: "Miss", + Ms: "Ms", + Mrs: "Mrs", + Dr: "Dr", +}; /** * @typedef {Object} embedded4 * @property {`${boolean}`} NamingThingsIsHard - NamingThingsIsHard is a law of programming * @property {boolean} Friends - Friends should not be shadowed in Person as embedded4 is not embedded from encoding/json's point of view; however, it should be shadowed in Embedded1 */ + +// In interface mode, this file is likely to contain just comments. +// We add a dummy export statement to ensure it is recognised as an ES module. +export {}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/models.js index 860b1303853..f4c863a35a1 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/models.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/models.js @@ -2,61 +2,21 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT +export { + Title +} from "./internal.js"; -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as $models from "./models.js"; -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as $internal from "./internal.js"; +import * as $models from "./internal.js"; /** - * @typedef {Object} Embedded1 - * @property {number} Friends - Friends should be shadowed in Person by a field of lesser depth - * @property {number} Vanish - Vanish should be omitted from Person because there is another field with same depth and no tag - * @property {string} StillThere - StillThere should be shadowed in Person by other field with same depth and a json tag - * @property {`${boolean}`} NamingThingsIsHard - NamingThingsIsHard is a law of programming + * @typedef {$models.Embedded1} Embedded1 */ /** - * @typedef {string} Embedded3 + * @typedef {$models.Embedded3} Embedded3 */ /** * Person represents a person - * @typedef { { - * "Titles"?: Title[] | null, - * "Names": string[] | null, - * "Partner": Person | null, - * "Friends": (Person | null)[] | null, - * "NamingThingsIsHard": `${boolean}`, - * "StillThere": Embedded3 | null, - * "-": number, - * "Embedded3": Embedded3, - * "StrangerNumber": `${number}`, - * "StrangestString"?: `"${string}"`, - * "StringStrangest"?: `"${string}"`, - * "emb4"?: $internal.embedded4, - * } } Person + * @typedef {$models.Person} Person */ - -/** - * Title is a title - * @readonly - * @enum {string} - */ -export const Title = { - /** - * The Go zero value for the underlying type of the enum. - */ - $zero: "", - - /** - * Mister is a title - */ - Mister: "Mr", - Miss: "Miss", - Ms: "Ms", - Mrs: "Mrs", - Dr: "Dr", -}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/greetservice.js index dd0ac2d2ce8..3de04dbbefa 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/greetservice.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/greetservice.js @@ -13,7 +13,7 @@ import {Call as $Call} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Greet does XYZ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/internal.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/internal.js new file mode 100644 index 00000000000..035bc0792bd --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/internal.js @@ -0,0 +1,13 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * Person represents a person + * @typedef {Object} Person + * @property {string} Name + */ + +// In interface mode, this file is likely to contain just comments. +// We add a dummy export statement to ensure it is recognised as an ES module. +export {}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/models.js index 2c36c592a84..a1cc75bffe2 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/models.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/models.js @@ -2,13 +2,9 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Person represents a person - * @typedef {Object} Person - * @property {string} Name + * @typedef {$models.Person} Person */ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/greetservice.js new file mode 100644 index 00000000000..b6788af43e8 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/greetservice.js @@ -0,0 +1,25 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Call as $Call} from "/wails/runtime.js"; + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import * as $models from "./internal.js"; + +/** + * Make a cycle. + * @returns {Promise<[$models.StructA, $models.StructC]> & { cancel(): void }} + */ +export function MakeCycles() { + let $resultPromise = /** @type {any} */($Call.ByID(440020721)); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/index.js new file mode 100644 index 00000000000..130c30a09ea --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/internal.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/internal.js new file mode 100644 index 00000000000..50e0d0fc0c8 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/internal.js @@ -0,0 +1,32 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * @typedef {Object} StructA + * @property {structB | null} B + */ + +/** + * @typedef {Object} StructC + * @property {structD} D + */ + +/** + * @typedef { { + * } } StructE + */ + +/** + * @typedef {Object} structB + * @property {StructA | null} A + */ + +/** + * @typedef {Object} structD + * @property {StructE} E + */ + +// In interface mode, this file is likely to contain just comments. +// We add a dummy export statement to ensure it is recognised as an ES module. +export {}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/models.js new file mode 100644 index 00000000000..f078dafd2fa --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/models.js @@ -0,0 +1,17 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as $models from "./internal.js"; + +/** + * @typedef {$models.StructA} StructA + */ + +/** + * @typedef {$models.StructC} StructC + */ + +/** + * @typedef {$models.StructE} StructE + */ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/greetservice.js similarity index 94% rename from v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/greetservice.js rename to v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/greetservice.js index dede5e3dac3..4d97ddc6567 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/greetservice.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/greetservice.js @@ -13,7 +13,7 @@ import {Call as $Call} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Make a cycle. diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/index.js new file mode 100644 index 00000000000..130c30a09ea --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/internal.js similarity index 69% rename from v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/models.js rename to v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/internal.js index b066c39826e..b9f0d91a57e 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/models.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/internal.js @@ -2,11 +2,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as $models from "./models.js"; - /** * @typedef {Cyclic | null} Alias */ @@ -19,3 +14,7 @@ import * as $models from "./models.js"; * @template T * @typedef {{"X": GenericCyclic | null, "Y": (T | null)[] | null}[] | null} GenericCyclic */ + +// In interface mode, this file is likely to contain just comments. +// We add a dummy export statement to ensure it is recognised as an ES module. +export {}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/models.js new file mode 100644 index 00000000000..1d70efd7035 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/models.js @@ -0,0 +1,18 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as $models from "./internal.js"; + +/** + * @typedef {$models.Alias} Alias + */ + +/** + * @typedef {$models.Cyclic} Cyclic + */ + +/** + * @template T + * @typedef {$models.GenericCyclic} GenericCyclic + */ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/greetservice.js index 8596b37d855..e29ab66956a 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/greetservice.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/greetservice.js @@ -13,7 +13,7 @@ import {Call as $Call} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Greet does XYZ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/internal.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/internal.js new file mode 100644 index 00000000000..2284fe5ab65 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/internal.js @@ -0,0 +1,35 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * Person represents a person + * @typedef {Object} Person + * @property {Title} Title + * @property {string} Name + */ + +/** + * Title is a title + * @readonly + * @enum {string} + */ +export const Title = { + /** + * The Go zero value for the underlying type of the enum. + */ + $zero: "", + + /** + * Mister is a title + */ + Mister: "Mr", + Miss: "Miss", + Ms: "Ms", + Mrs: "Mrs", + Dr: "Dr", +}; + +// In interface mode, this file is likely to contain just comments. +// We add a dummy export statement to ensure it is recognised as an ES module. +export {}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/models.js index 550c5b3b17d..c72d9628b70 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/models.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/models.js @@ -2,35 +2,13 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT +export { + Title +} from "./internal.js"; -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Person represents a person - * @typedef {Object} Person - * @property {Title} Title - * @property {string} Name + * @typedef {$models.Person} Person */ - -/** - * Title is a title - * @readonly - * @enum {string} - */ -export const Title = { - /** - * The Go zero value for the underlying type of the enum. - */ - $zero: "", - - /** - * Mister is a title - */ - Mister: "Mr", - Miss: "Miss", - Ms: "Ms", - Mrs: "Mrs", - Dr: "Dr", -}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/internal.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/internal.js new file mode 100644 index 00000000000..e0e2d301427 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/internal.js @@ -0,0 +1,27 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * @readonly + * @enum {string} + */ +export const Title = { + /** + * The Go zero value for the underlying type of the enum. + */ + $zero: "", + + /** + * Mister is a title + */ + Mister: "Mr", + Miss: "Miss", + Ms: "Ms", + Mrs: "Mrs", + Dr: "Dr", +}; + +// In interface mode, this file is likely to contain just comments. +// We add a dummy export statement to ensure it is recognised as an ES module. +export {}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/models.js index 67f87183cb8..389f670e2bf 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/models.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/models.js @@ -2,27 +2,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as $models from "./models.js"; - -/** - * @readonly - * @enum {string} - */ -export const Title = { - /** - * The Go zero value for the underlying type of the enum. - */ - $zero: "", - - /** - * Mister is a title - */ - Mister: "Mr", - Miss: "Miss", - Ms: "Ms", - Mrs: "Mrs", - Dr: "Dr", -}; +export { + Title +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/greetservice.js index 4e1a41312f4..e30ba609dc9 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/greetservice.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/greetservice.js @@ -13,7 +13,7 @@ import {Call as $Call} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Greet does XYZ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/internal.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/internal.js new file mode 100644 index 00000000000..5743a905548 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/internal.js @@ -0,0 +1,18 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import * as services$0 from "./services/models.js"; + +/** + * Person is a person + * @typedef {Object} Person + * @property {string} Name + * @property {services$0.Address | null} Address + */ + +// In interface mode, this file is likely to contain just comments. +// We add a dummy export statement to ensure it is recognised as an ES module. +export {}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/models.js index eaa9fd40b35..011bbfe7bfa 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/models.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/models.js @@ -2,18 +2,9 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as services$0 from "./services/models.js"; - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Person is a person - * @typedef {Object} Person - * @property {string} Name - * @property {services$0.Address | null} Address + * @typedef {$models.Person} Person */ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/internal.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/internal.js new file mode 100644 index 00000000000..c04e3b10b1a --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/internal.js @@ -0,0 +1,14 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * @typedef {Object} Address + * @property {string} Street + * @property {string} State + * @property {string} Country + */ + +// In interface mode, this file is likely to contain just comments. +// We add a dummy export statement to ensure it is recognised as an ES module. +export {}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/models.js index 9aa2efef9c1..df9ca0eefd7 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/models.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/models.js @@ -2,14 +2,8 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** - * @typedef {Object} Address - * @property {string} Street - * @property {string} State - * @property {string} Country + * @typedef {$models.Address} Address */ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/otherservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/otherservice.js index 96dc85e8f78..961fe45d2af 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/otherservice.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/otherservice.js @@ -14,7 +14,7 @@ import {Call as $Call} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Yay does this and that diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/greetservice.js index 4e1a41312f4..e30ba609dc9 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/greetservice.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/greetservice.js @@ -13,7 +13,7 @@ import {Call as $Call} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Greet does XYZ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/internal.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/internal.js new file mode 100644 index 00000000000..8a989061700 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/internal.js @@ -0,0 +1,17 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import * as other$0 from "./services/other/models.js"; + +/** + * @typedef {Object} Person + * @property {string} Name + * @property {other$0.Address | null} Address + */ + +// In interface mode, this file is likely to contain just comments. +// We add a dummy export statement to ensure it is recognised as an ES module. +export {}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/models.js index 3c6c81379c0..0776019c7bf 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/models.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/models.js @@ -2,17 +2,8 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as other$0 from "./services/other/models.js"; - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** - * @typedef {Object} Person - * @property {string} Name - * @property {other$0.Address | null} Address + * @typedef {$models.Person} Person */ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/internal.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/internal.js new file mode 100644 index 00000000000..c04e3b10b1a --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/internal.js @@ -0,0 +1,14 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * @typedef {Object} Address + * @property {string} Street + * @property {string} State + * @property {string} Country + */ + +// In interface mode, this file is likely to contain just comments. +// We add a dummy export statement to ensure it is recognised as an ES module. +export {}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/models.js index 9aa2efef9c1..df9ca0eefd7 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/models.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/models.js @@ -2,14 +2,8 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** - * @typedef {Object} Address - * @property {string} Street - * @property {string} State - * @property {string} Country + * @typedef {$models.Address} Address */ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/otherservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/otherservice.js index acc6a59de92..c76ecbec2df 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/otherservice.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/otherservice.js @@ -14,7 +14,7 @@ import {Call as $Call} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Yay does this and that diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_internal/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_internal/greetservice.js new file mode 100644 index 00000000000..a46cb2e4f4b --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_internal/greetservice.js @@ -0,0 +1,22 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Call as $Call} from "/wails/runtime.js"; + +/** + * Greet someone + * @param {string} name + * @returns {Promise & { cancel(): void }} + */ +export function Greet(name) { + let $resultPromise = /** @type {any} */($Call.ByID(1411160069, name)); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_internal/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_internal/index.js new file mode 100644 index 00000000000..fdf1ff435a9 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_internal/index.js @@ -0,0 +1,8 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/internal.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/internal.js index bf12da04c53..775b364318c 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/internal.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/internal.js @@ -2,13 +2,41 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT - // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as other$0 from "./other/models.js"; + +/** + * HowDifferent is a curious kind of person + * that lets other people decide how they are different. + * @template How + * @typedef {other$0.OtherPerson<{ [_: string]: How | null } | null>} HowDifferent + */ + +/** + * Impersonator gets their fields from other people. + * @typedef {other$0.OtherPerson} Impersonator + */ + +/** + * Person is not a number. + * @typedef {Object} Person + * @property {string} Name - They have a name. + * @property {Impersonator[]} Friends - Exactly 4 sketchy friends. + */ + +/** + * PrivatePerson gets their fields from hidden sources. + * @typedef {personImpl} PrivatePerson + */ /** * @typedef {Object} personImpl * @property {string} Nickname - Nickname conceals a person's identity. * @property {string} Name - They have a name. + * @property {Impersonator[]} Friends - Exactly 4 sketchy friends. */ + +// In interface mode, this file is likely to contain just comments. +// We add a dummy export statement to ensure it is recognised as an ES module. +export {}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/models.js index 1d9db9f99c4..df787195382 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/models.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/models.js @@ -2,37 +2,26 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as other$0 from "./other/models.js"; - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as $models from "./models.js"; -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as $internal from "./internal.js"; +import * as $models from "./internal.js"; /** * HowDifferent is a curious kind of person * that lets other people decide how they are different. * @template How - * @typedef {other$0.OtherPerson<{ [_: string]: How | null } | null>} HowDifferent + * @typedef {$models.HowDifferent} HowDifferent */ /** * Impersonator gets their fields from other people. - * @typedef {other$0.OtherPerson} Impersonator + * @typedef {$models.Impersonator} Impersonator */ /** * Person is not a number. - * @typedef {Object} Person - * @property {string} Name - They have a name. + * @typedef {$models.Person} Person */ /** * PrivatePerson gets their fields from hidden sources. - * @typedef {$internal.personImpl} PrivatePerson + * @typedef {$models.PrivatePerson} PrivatePerson */ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/internal.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/internal.js new file mode 100644 index 00000000000..da57b768f99 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/internal.js @@ -0,0 +1,15 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * OtherPerson is like a person, but different. + * @template T + * @typedef {Object} OtherPerson + * @property {string} Name - They have a name as well. + * @property {(T | null)[] | null} Differences - But they may have many differences. + */ + +// In interface mode, this file is likely to contain just comments. +// We add a dummy export statement to ensure it is recognised as an ES module. +export {}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/models.js index 6227bce5bb2..ccd91bda828 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/models.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/models.js @@ -2,15 +2,10 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * OtherPerson is like a person, but different. * @template T - * @typedef {Object} OtherPerson - * @property {string} Name - They have a name as well. - * @property {(T | null)[] | null} Differences - But they may have many differences. + * @typedef {$models.OtherPerson} OtherPerson */ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/somemethods.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/somemethods.js index 615b2a001cb..876275f057a 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/somemethods.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/somemethods.js @@ -13,11 +13,11 @@ import {Call as $Call} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * LikeThisOne is an example method that does nothing. - * @returns {Promise<[$models.Person, $models.Impersonator, $models.HowDifferent, $models.PrivatePerson]> & { cancel(): void }} + * @returns {Promise<[$models.Person, $models.HowDifferent, $models.PrivatePerson]> & { cancel(): void }} */ export function LikeThisOne() { let $resultPromise = /** @type {any} */($Call.ByID(2124352079)); diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/embedservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/embedservice.js index e8246987d34..48bff3e1ba5 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/embedservice.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/embedservice.js @@ -17,7 +17,7 @@ import * as nobindingshere$0 from "../no_bindings_here/models.js"; /** * LikeThisOne is an example method that does nothing. - * @returns {Promise<[nobindingshere$0.Person, nobindingshere$0.Impersonator, nobindingshere$0.HowDifferent, nobindingshere$0.PrivatePerson]> & { cancel(): void }} + * @returns {Promise<[nobindingshere$0.Person, nobindingshere$0.HowDifferent, nobindingshere$0.PrivatePerson]> & { cancel(): void }} */ export function LikeThisOne() { let $resultPromise = /** @type {any} */($Call.ByID(2590614085)); diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/greetservice.js index 4e1a41312f4..e30ba609dc9 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/greetservice.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/greetservice.js @@ -13,7 +13,7 @@ import {Call as $Call} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Greet does XYZ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/internal.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/internal.js new file mode 100644 index 00000000000..41b452f5714 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/internal.js @@ -0,0 +1,17 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import * as services$0 from "./services/models.js"; + +/** + * @typedef {Object} Person + * @property {string} Name + * @property {services$0.Address | null} Address + */ + +// In interface mode, this file is likely to contain just comments. +// We add a dummy export statement to ensure it is recognised as an ES module. +export {}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/models.js index db2839c9f15..0776019c7bf 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/models.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/models.js @@ -2,17 +2,8 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as services$0 from "./services/models.js"; - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** - * @typedef {Object} Person - * @property {string} Name - * @property {services$0.Address | null} Address + * @typedef {$models.Person} Person */ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/internal.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/internal.js new file mode 100644 index 00000000000..c04e3b10b1a --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/internal.js @@ -0,0 +1,14 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * @typedef {Object} Address + * @property {string} Street + * @property {string} State + * @property {string} Country + */ + +// In interface mode, this file is likely to contain just comments. +// We add a dummy export statement to ensure it is recognised as an ES module. +export {}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/models.js index 9aa2efef9c1..df9ca0eefd7 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/models.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/models.js @@ -2,14 +2,8 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** - * @typedef {Object} Address - * @property {string} Street - * @property {string} State - * @property {string} Country + * @typedef {$models.Address} Address */ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/otherservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/otherservice.js index 5f91bf18c46..cba8a9892a6 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/otherservice.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/otherservice.js @@ -14,7 +14,7 @@ import {Call as $Call} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Yay does this and that diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/greetservice.js index 3ee3f998009..d38d4add712 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/greetservice.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/greetservice.js @@ -13,7 +13,7 @@ import {Call as $Call} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * @param {number[]} $in diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/internal.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/internal.js new file mode 100644 index 00000000000..ec6136e27b2 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/internal.js @@ -0,0 +1,14 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * @typedef {Object} Person + * @property {string} Name + * @property {Person | null} Parent + * @property {{"Age": number, "Address": {"Street": string}}} Details + */ + +// In interface mode, this file is likely to contain just comments. +// We add a dummy export statement to ensure it is recognised as an ES module. +export {}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/models.js index a08f855a065..0776019c7bf 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/models.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/models.js @@ -2,14 +2,8 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** - * @typedef {Object} Person - * @property {string} Name - * @property {Person | null} Parent - * @property {{"Age": number, "Address": {"Street": string}}} Details + * @typedef {$models.Person} Person */ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/greetservice.js index 3ee3f998009..d38d4add712 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/greetservice.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/greetservice.js @@ -13,7 +13,7 @@ import {Call as $Call} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * @param {number[]} $in diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/internal.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/internal.js new file mode 100644 index 00000000000..ec6136e27b2 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/internal.js @@ -0,0 +1,14 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * @typedef {Object} Person + * @property {string} Name + * @property {Person | null} Parent + * @property {{"Age": number, "Address": {"Street": string}}} Details + */ + +// In interface mode, this file is likely to contain just comments. +// We add a dummy export statement to ensure it is recognised as an ES module. +export {}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/models.js index a08f855a065..0776019c7bf 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/models.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/models.js @@ -2,14 +2,8 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** - * @typedef {Object} Person - * @property {string} Name - * @property {Person | null} Parent - * @property {{"Age": number, "Address": {"Street": string}}} Details + * @typedef {$models.Person} Person */ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/greetservice.js index 4e1a41312f4..e30ba609dc9 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/greetservice.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/greetservice.js @@ -13,7 +13,7 @@ import {Call as $Call} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Greet does XYZ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/internal.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/internal.js new file mode 100644 index 00000000000..ab5cea25517 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/internal.js @@ -0,0 +1,19 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import * as services$0 from "./services/models.js"; + +/** + * Person is a person! + * They have a name and an address + * @typedef {Object} Person + * @property {string} Name + * @property {services$0.Address | null} Address + */ + +// In interface mode, this file is likely to contain just comments. +// We add a dummy export statement to ensure it is recognised as an ES module. +export {}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/models.js index 61451847c35..bb05b1c00d2 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/models.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/models.js @@ -2,19 +2,10 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as services$0 from "./services/models.js"; - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Person is a person! * They have a name and an address - * @typedef {Object} Person - * @property {string} Name - * @property {services$0.Address | null} Address + * @typedef {$models.Person} Person */ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/internal.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/internal.js new file mode 100644 index 00000000000..c04e3b10b1a --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/internal.js @@ -0,0 +1,14 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * @typedef {Object} Address + * @property {string} Street + * @property {string} State + * @property {string} Country + */ + +// In interface mode, this file is likely to contain just comments. +// We add a dummy export statement to ensure it is recognised as an ES module. +export {}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/models.js index 9aa2efef9c1..df9ca0eefd7 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/models.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/models.js @@ -2,14 +2,8 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** - * @typedef {Object} Address - * @property {string} Street - * @property {string} State - * @property {string} Country + * @typedef {$models.Address} Address */ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/otherservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/otherservice.js index fba063a2ba0..d7f43fcdfae 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/otherservice.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/otherservice.js @@ -14,7 +14,7 @@ import {Call as $Call} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Yay does this and that diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/greetservice.js index 82a886e44d2..9f375a95b80 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/greetservice.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/greetservice.js @@ -13,10 +13,10 @@ import {Call as $Call} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** - * Get someone + * Get someone. * @param {$models.Alias} aliasValue * @returns {Promise<$models.Person> & { cancel(): void }} */ @@ -26,7 +26,17 @@ export function Get(aliasValue) { } /** - * Get someone quite different + * Apparently, aliases are all the rage right now. + * @param {$models.AliasedPerson} p + * @returns {Promise<$models.StrangelyAliasedPerson> & { cancel(): void }} + */ +export function GetButAliased(p) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.GetButAliased", p)); + return $resultPromise; +} + +/** + * Get someone quite different. * @returns {Promise<$models.GenericPerson> & { cancel(): void }} */ export function GetButDifferent() { diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/internal.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/internal.js new file mode 100644 index 00000000000..756c523b0ad --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/internal.js @@ -0,0 +1,65 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * A nice type Alias. + * @typedef {number} Alias + */ + +/** + * A struct alias. + * This should be rendered as a typedef or interface in every mode. + * @typedef {Object} AliasStruct + * @property {number[] | null} Foo - A field with a comment. + * @property {string} [Bar] - Definitely not Foo. + * @property {string} [Baz] - Definitely not Foo. + * @property {OtherAliasStruct} Other - A nested alias struct. + */ + +/** + * A class alias. + * @typedef {Person} AliasedPerson + */ + +/** + * An empty struct alias. + * @typedef { { + * } } EmptyAliasStruct + */ + +/** + * An empty struct. + * @typedef { { + * } } EmptyStruct + */ + +/** + * A generic struct containing an alias. + * @template T + * @typedef {Object} GenericPerson + * @property {T | null} Name + * @property {Alias} AliasedField + */ + +/** + * Another struct alias. + * @typedef {Object} OtherAliasStruct + * @property {number[] | null} NoMoreIdeas + */ + +/** + * A non-generic struct containing an alias. + * @typedef {Object} Person + * @property {string} Name - The Person's name. + * @property {Alias} AliasedField - A random alias field. + */ + +/** + * Another class alias, but ordered after its aliased class. + * @typedef {Person} StrangelyAliasedPerson + */ + +// In interface mode, this file is likely to contain just comments. +// We add a dummy export statement to ensure it is recognised as an ES module. +export {}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/models.js index dfcbbe91f58..bfecf2d1a3a 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/models.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/models.js @@ -2,55 +2,51 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** - * A nice type Alias - * @typedef {number} Alias + * A nice type Alias. + * @typedef {$models.Alias} Alias */ /** * A struct alias. * This should be rendered as a typedef or interface in every mode. - * @typedef {Object} AliasStruct - * @property {number[] | null} Foo - A field with a comment. - * @property {string} [Bar] - Definitely not Foo. - * @property {string} [Baz] - Definitely not Foo. - * @property {OtherAliasStruct} Other - A nested alias struct. + * @typedef {$models.AliasStruct} AliasStruct + */ + +/** + * A class alias. + * @typedef {$models.AliasedPerson} AliasedPerson */ /** * An empty struct alias. - * @typedef { { - * } } EmptyAliasStruct + * @typedef {$models.EmptyAliasStruct} EmptyAliasStruct */ /** * An empty struct. - * @typedef { { - * } } EmptyStruct + * @typedef {$models.EmptyStruct} EmptyStruct */ /** - * A generic struct containing an alias + * A generic struct containing an alias. * @template T - * @typedef {Object} GenericPerson - * @property {T | null} Name - * @property {Alias} AliasedField + * @typedef {$models.GenericPerson} GenericPerson */ /** * Another struct alias. - * @typedef {Object} OtherAliasStruct - * @property {number[] | null} NoMoreIdeas + * @typedef {$models.OtherAliasStruct} OtherAliasStruct */ /** * A non-generic struct containing an alias. - * @typedef {Object} Person - * @property {string} Name - The Person's name. - * @property {Alias} AliasedField - A random alias field. + * @typedef {$models.Person} Person + */ + +/** + * Another class alias, but ordered after its aliased class. + * @typedef {$models.StrangelyAliasedPerson} StrangelyAliasedPerson */ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/greetservice.js index dad26c793ac..70d826c0bfd 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/greetservice.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/greetservice.js @@ -13,7 +13,7 @@ import {Call as $Call} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Greet does XYZ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/internal.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/internal.js index deaa31ce4d4..b3063077765 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/internal.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/internal.js @@ -2,13 +2,63 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT +/** + * @typedef {Object} Embedded1 + * @property {number} Friends - Friends should be shadowed in Person by a field of lesser depth + * @property {number} Vanish - Vanish should be omitted from Person because there is another field with same depth and no tag + * @property {string} StillThere - StillThere should be shadowed in Person by other field with same depth and a json tag + * @property {`${boolean}`} NamingThingsIsHard - NamingThingsIsHard is a law of programming + */ -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as $models from "./models.js"; +/** + * @typedef {string} Embedded3 + */ + +/** + * Person represents a person + * @typedef { { + * "Titles"?: Title[] | null, + * "Names": string[] | null, + * "Partner": Person | null, + * "Friends": (Person | null)[] | null, + * "NamingThingsIsHard": `${boolean}`, + * "StillThere": Embedded3 | null, + * "-": number, + * "Embedded3": Embedded3, + * "StrangerNumber": `${number}`, + * "StrangestString"?: `"${string}"`, + * "StringStrangest"?: `"${string}"`, + * "emb4"?: embedded4, + * } } Person + */ + +/** + * Title is a title + * @readonly + * @enum {string} + */ +export const Title = { + /** + * The Go zero value for the underlying type of the enum. + */ + $zero: "", + + /** + * Mister is a title + */ + Mister: "Mr", + Miss: "Miss", + Ms: "Ms", + Mrs: "Mrs", + Dr: "Dr", +}; /** * @typedef {Object} embedded4 * @property {`${boolean}`} NamingThingsIsHard - NamingThingsIsHard is a law of programming * @property {boolean} Friends - Friends should not be shadowed in Person as embedded4 is not embedded from encoding/json's point of view; however, it should be shadowed in Embedded1 */ + +// In interface mode, this file is likely to contain just comments. +// We add a dummy export statement to ensure it is recognised as an ES module. +export {}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/models.js index 860b1303853..f4c863a35a1 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/models.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/models.js @@ -2,61 +2,21 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT +export { + Title +} from "./internal.js"; -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as $models from "./models.js"; -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as $internal from "./internal.js"; +import * as $models from "./internal.js"; /** - * @typedef {Object} Embedded1 - * @property {number} Friends - Friends should be shadowed in Person by a field of lesser depth - * @property {number} Vanish - Vanish should be omitted from Person because there is another field with same depth and no tag - * @property {string} StillThere - StillThere should be shadowed in Person by other field with same depth and a json tag - * @property {`${boolean}`} NamingThingsIsHard - NamingThingsIsHard is a law of programming + * @typedef {$models.Embedded1} Embedded1 */ /** - * @typedef {string} Embedded3 + * @typedef {$models.Embedded3} Embedded3 */ /** * Person represents a person - * @typedef { { - * "Titles"?: Title[] | null, - * "Names": string[] | null, - * "Partner": Person | null, - * "Friends": (Person | null)[] | null, - * "NamingThingsIsHard": `${boolean}`, - * "StillThere": Embedded3 | null, - * "-": number, - * "Embedded3": Embedded3, - * "StrangerNumber": `${number}`, - * "StrangestString"?: `"${string}"`, - * "StringStrangest"?: `"${string}"`, - * "emb4"?: $internal.embedded4, - * } } Person + * @typedef {$models.Person} Person */ - -/** - * Title is a title - * @readonly - * @enum {string} - */ -export const Title = { - /** - * The Go zero value for the underlying type of the enum. - */ - $zero: "", - - /** - * Mister is a title - */ - Mister: "Mr", - Miss: "Miss", - Ms: "Ms", - Mrs: "Mrs", - Dr: "Dr", -}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/greetservice.js index 0569e8802e8..df49512d12f 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/greetservice.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/greetservice.js @@ -13,7 +13,7 @@ import {Call as $Call} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Greet does XYZ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/internal.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/internal.js new file mode 100644 index 00000000000..035bc0792bd --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/internal.js @@ -0,0 +1,13 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * Person represents a person + * @typedef {Object} Person + * @property {string} Name + */ + +// In interface mode, this file is likely to contain just comments. +// We add a dummy export statement to ensure it is recognised as an ES module. +export {}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/models.js index 2c36c592a84..a1cc75bffe2 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/models.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/models.js @@ -2,13 +2,9 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Person represents a person - * @typedef {Object} Person - * @property {string} Name + * @typedef {$models.Person} Person */ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/greetservice.js new file mode 100644 index 00000000000..b817bd695be --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/greetservice.js @@ -0,0 +1,25 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Call as $Call} from "/wails/runtime.js"; + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import * as $models from "./internal.js"; + +/** + * Make a cycle. + * @returns {Promise<[$models.StructA, $models.StructC]> & { cancel(): void }} + */ +export function MakeCycles() { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.MakeCycles")); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/index.js new file mode 100644 index 00000000000..130c30a09ea --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/internal.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/internal.js new file mode 100644 index 00000000000..50e0d0fc0c8 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/internal.js @@ -0,0 +1,32 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * @typedef {Object} StructA + * @property {structB | null} B + */ + +/** + * @typedef {Object} StructC + * @property {structD} D + */ + +/** + * @typedef { { + * } } StructE + */ + +/** + * @typedef {Object} structB + * @property {StructA | null} A + */ + +/** + * @typedef {Object} structD + * @property {StructE} E + */ + +// In interface mode, this file is likely to contain just comments. +// We add a dummy export statement to ensure it is recognised as an ES module. +export {}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/models.js new file mode 100644 index 00000000000..f078dafd2fa --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/models.js @@ -0,0 +1,17 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as $models from "./internal.js"; + +/** + * @typedef {$models.StructA} StructA + */ + +/** + * @typedef {$models.StructC} StructC + */ + +/** + * @typedef {$models.StructE} StructE + */ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/greetservice.js similarity index 94% rename from v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/greetservice.js rename to v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/greetservice.js index 5ae511419ca..dc14e959291 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/greetservice.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/greetservice.js @@ -13,7 +13,7 @@ import {Call as $Call} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Make a cycle. diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/index.js new file mode 100644 index 00000000000..130c30a09ea --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/internal.js similarity index 69% rename from v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/models.js rename to v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/internal.js index b066c39826e..b9f0d91a57e 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/models.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/internal.js @@ -2,11 +2,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as $models from "./models.js"; - /** * @typedef {Cyclic | null} Alias */ @@ -19,3 +14,7 @@ import * as $models from "./models.js"; * @template T * @typedef {{"X": GenericCyclic | null, "Y": (T | null)[] | null}[] | null} GenericCyclic */ + +// In interface mode, this file is likely to contain just comments. +// We add a dummy export statement to ensure it is recognised as an ES module. +export {}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/models.js new file mode 100644 index 00000000000..1d70efd7035 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/models.js @@ -0,0 +1,18 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as $models from "./internal.js"; + +/** + * @typedef {$models.Alias} Alias + */ + +/** + * @typedef {$models.Cyclic} Cyclic + */ + +/** + * @template T + * @typedef {$models.GenericCyclic} GenericCyclic + */ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/greetservice.js index 6d764269cc4..b2dc598fc44 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/greetservice.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/greetservice.js @@ -13,7 +13,7 @@ import {Call as $Call} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Greet does XYZ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/internal.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/internal.js new file mode 100644 index 00000000000..2284fe5ab65 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/internal.js @@ -0,0 +1,35 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * Person represents a person + * @typedef {Object} Person + * @property {Title} Title + * @property {string} Name + */ + +/** + * Title is a title + * @readonly + * @enum {string} + */ +export const Title = { + /** + * The Go zero value for the underlying type of the enum. + */ + $zero: "", + + /** + * Mister is a title + */ + Mister: "Mr", + Miss: "Miss", + Ms: "Ms", + Mrs: "Mrs", + Dr: "Dr", +}; + +// In interface mode, this file is likely to contain just comments. +// We add a dummy export statement to ensure it is recognised as an ES module. +export {}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/models.js index 550c5b3b17d..c72d9628b70 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/models.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/models.js @@ -2,35 +2,13 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT +export { + Title +} from "./internal.js"; -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Person represents a person - * @typedef {Object} Person - * @property {Title} Title - * @property {string} Name + * @typedef {$models.Person} Person */ - -/** - * Title is a title - * @readonly - * @enum {string} - */ -export const Title = { - /** - * The Go zero value for the underlying type of the enum. - */ - $zero: "", - - /** - * Mister is a title - */ - Mister: "Mr", - Miss: "Miss", - Ms: "Ms", - Mrs: "Mrs", - Dr: "Dr", -}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/internal.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/internal.js new file mode 100644 index 00000000000..e0e2d301427 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/internal.js @@ -0,0 +1,27 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * @readonly + * @enum {string} + */ +export const Title = { + /** + * The Go zero value for the underlying type of the enum. + */ + $zero: "", + + /** + * Mister is a title + */ + Mister: "Mr", + Miss: "Miss", + Ms: "Ms", + Mrs: "Mrs", + Dr: "Dr", +}; + +// In interface mode, this file is likely to contain just comments. +// We add a dummy export statement to ensure it is recognised as an ES module. +export {}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/models.js index 67f87183cb8..389f670e2bf 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/models.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/models.js @@ -2,27 +2,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as $models from "./models.js"; - -/** - * @readonly - * @enum {string} - */ -export const Title = { - /** - * The Go zero value for the underlying type of the enum. - */ - $zero: "", - - /** - * Mister is a title - */ - Mister: "Mr", - Miss: "Miss", - Ms: "Ms", - Mrs: "Mrs", - Dr: "Dr", -}; +export { + Title +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/greetservice.js index 0896a296de5..2a19fe849d2 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/greetservice.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/greetservice.js @@ -13,7 +13,7 @@ import {Call as $Call} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Greet does XYZ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/internal.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/internal.js new file mode 100644 index 00000000000..5743a905548 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/internal.js @@ -0,0 +1,18 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import * as services$0 from "./services/models.js"; + +/** + * Person is a person + * @typedef {Object} Person + * @property {string} Name + * @property {services$0.Address | null} Address + */ + +// In interface mode, this file is likely to contain just comments. +// We add a dummy export statement to ensure it is recognised as an ES module. +export {}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/models.js index eaa9fd40b35..011bbfe7bfa 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/models.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/models.js @@ -2,18 +2,9 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as services$0 from "./services/models.js"; - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Person is a person - * @typedef {Object} Person - * @property {string} Name - * @property {services$0.Address | null} Address + * @typedef {$models.Person} Person */ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/internal.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/internal.js new file mode 100644 index 00000000000..c04e3b10b1a --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/internal.js @@ -0,0 +1,14 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * @typedef {Object} Address + * @property {string} Street + * @property {string} State + * @property {string} Country + */ + +// In interface mode, this file is likely to contain just comments. +// We add a dummy export statement to ensure it is recognised as an ES module. +export {}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/models.js index 9aa2efef9c1..df9ca0eefd7 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/models.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/models.js @@ -2,14 +2,8 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** - * @typedef {Object} Address - * @property {string} Street - * @property {string} State - * @property {string} Country + * @typedef {$models.Address} Address */ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/otherservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/otherservice.js index 61a94621e59..91ea47db886 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/otherservice.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/otherservice.js @@ -14,7 +14,7 @@ import {Call as $Call} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Yay does this and that diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/greetservice.js index 0896a296de5..2a19fe849d2 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/greetservice.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/greetservice.js @@ -13,7 +13,7 @@ import {Call as $Call} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Greet does XYZ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/internal.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/internal.js new file mode 100644 index 00000000000..8a989061700 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/internal.js @@ -0,0 +1,17 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import * as other$0 from "./services/other/models.js"; + +/** + * @typedef {Object} Person + * @property {string} Name + * @property {other$0.Address | null} Address + */ + +// In interface mode, this file is likely to contain just comments. +// We add a dummy export statement to ensure it is recognised as an ES module. +export {}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/models.js index 3c6c81379c0..0776019c7bf 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/models.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/models.js @@ -2,17 +2,8 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as other$0 from "./services/other/models.js"; - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** - * @typedef {Object} Person - * @property {string} Name - * @property {other$0.Address | null} Address + * @typedef {$models.Person} Person */ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/internal.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/internal.js new file mode 100644 index 00000000000..c04e3b10b1a --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/internal.js @@ -0,0 +1,14 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * @typedef {Object} Address + * @property {string} Street + * @property {string} State + * @property {string} Country + */ + +// In interface mode, this file is likely to contain just comments. +// We add a dummy export statement to ensure it is recognised as an ES module. +export {}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/models.js index 9aa2efef9c1..df9ca0eefd7 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/models.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/models.js @@ -2,14 +2,8 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** - * @typedef {Object} Address - * @property {string} Street - * @property {string} State - * @property {string} Country + * @typedef {$models.Address} Address */ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/otherservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/otherservice.js index abc8c9adc21..858686c9a5d 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/otherservice.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/otherservice.js @@ -14,7 +14,7 @@ import {Call as $Call} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Yay does this and that diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_internal/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_internal/greetservice.js new file mode 100644 index 00000000000..f89c81e83d2 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_internal/greetservice.js @@ -0,0 +1,22 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Call as $Call} from "/wails/runtime.js"; + +/** + * Greet someone + * @param {string} name + * @returns {Promise & { cancel(): void }} + */ +export function Greet(name) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Greet", name)); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_internal/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_internal/index.js new file mode 100644 index 00000000000..fdf1ff435a9 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_internal/index.js @@ -0,0 +1,8 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/internal.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/internal.js index bf12da04c53..775b364318c 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/internal.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/internal.js @@ -2,13 +2,41 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT - // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as other$0 from "./other/models.js"; + +/** + * HowDifferent is a curious kind of person + * that lets other people decide how they are different. + * @template How + * @typedef {other$0.OtherPerson<{ [_: string]: How | null } | null>} HowDifferent + */ + +/** + * Impersonator gets their fields from other people. + * @typedef {other$0.OtherPerson} Impersonator + */ + +/** + * Person is not a number. + * @typedef {Object} Person + * @property {string} Name - They have a name. + * @property {Impersonator[]} Friends - Exactly 4 sketchy friends. + */ + +/** + * PrivatePerson gets their fields from hidden sources. + * @typedef {personImpl} PrivatePerson + */ /** * @typedef {Object} personImpl * @property {string} Nickname - Nickname conceals a person's identity. * @property {string} Name - They have a name. + * @property {Impersonator[]} Friends - Exactly 4 sketchy friends. */ + +// In interface mode, this file is likely to contain just comments. +// We add a dummy export statement to ensure it is recognised as an ES module. +export {}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/models.js index 1d9db9f99c4..df787195382 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/models.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/models.js @@ -2,37 +2,26 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as other$0 from "./other/models.js"; - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as $models from "./models.js"; -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as $internal from "./internal.js"; +import * as $models from "./internal.js"; /** * HowDifferent is a curious kind of person * that lets other people decide how they are different. * @template How - * @typedef {other$0.OtherPerson<{ [_: string]: How | null } | null>} HowDifferent + * @typedef {$models.HowDifferent} HowDifferent */ /** * Impersonator gets their fields from other people. - * @typedef {other$0.OtherPerson} Impersonator + * @typedef {$models.Impersonator} Impersonator */ /** * Person is not a number. - * @typedef {Object} Person - * @property {string} Name - They have a name. + * @typedef {$models.Person} Person */ /** * PrivatePerson gets their fields from hidden sources. - * @typedef {$internal.personImpl} PrivatePerson + * @typedef {$models.PrivatePerson} PrivatePerson */ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/internal.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/internal.js new file mode 100644 index 00000000000..da57b768f99 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/internal.js @@ -0,0 +1,15 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * OtherPerson is like a person, but different. + * @template T + * @typedef {Object} OtherPerson + * @property {string} Name - They have a name as well. + * @property {(T | null)[] | null} Differences - But they may have many differences. + */ + +// In interface mode, this file is likely to contain just comments. +// We add a dummy export statement to ensure it is recognised as an ES module. +export {}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/models.js index 6227bce5bb2..ccd91bda828 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/models.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/models.js @@ -2,15 +2,10 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * OtherPerson is like a person, but different. * @template T - * @typedef {Object} OtherPerson - * @property {string} Name - They have a name as well. - * @property {(T | null)[] | null} Differences - But they may have many differences. + * @typedef {$models.OtherPerson} OtherPerson */ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/somemethods.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/somemethods.js index 8eef0c5b66e..82c036b6983 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/somemethods.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/somemethods.js @@ -13,11 +13,11 @@ import {Call as $Call} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * LikeThisOne is an example method that does nothing. - * @returns {Promise<[$models.Person, $models.Impersonator, $models.HowDifferent, $models.PrivatePerson]> & { cancel(): void }} + * @returns {Promise<[$models.Person, $models.HowDifferent, $models.PrivatePerson]> & { cancel(): void }} */ export function LikeThisOne() { let $resultPromise = /** @type {any} */($Call.ByName("github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here.SomeMethods.LikeThisOne")); diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/embedservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/embedservice.js index cb76db7b25a..b35360d805d 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/embedservice.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/embedservice.js @@ -17,7 +17,7 @@ import * as nobindingshere$0 from "../no_bindings_here/models.js"; /** * LikeThisOne is an example method that does nothing. - * @returns {Promise<[nobindingshere$0.Person, nobindingshere$0.Impersonator, nobindingshere$0.HowDifferent, nobindingshere$0.PrivatePerson]> & { cancel(): void }} + * @returns {Promise<[nobindingshere$0.Person, nobindingshere$0.HowDifferent, nobindingshere$0.PrivatePerson]> & { cancel(): void }} */ export function LikeThisOne() { let $resultPromise = /** @type {any} */($Call.ByName("main.EmbedService.LikeThisOne")); diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/greetservice.js index 0896a296de5..2a19fe849d2 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/greetservice.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/greetservice.js @@ -13,7 +13,7 @@ import {Call as $Call} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Greet does XYZ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/internal.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/internal.js new file mode 100644 index 00000000000..41b452f5714 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/internal.js @@ -0,0 +1,17 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import * as services$0 from "./services/models.js"; + +/** + * @typedef {Object} Person + * @property {string} Name + * @property {services$0.Address | null} Address + */ + +// In interface mode, this file is likely to contain just comments. +// We add a dummy export statement to ensure it is recognised as an ES module. +export {}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/models.js index db2839c9f15..0776019c7bf 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/models.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/models.js @@ -2,17 +2,8 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as services$0 from "./services/models.js"; - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** - * @typedef {Object} Person - * @property {string} Name - * @property {services$0.Address | null} Address + * @typedef {$models.Person} Person */ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/internal.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/internal.js new file mode 100644 index 00000000000..c04e3b10b1a --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/internal.js @@ -0,0 +1,14 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * @typedef {Object} Address + * @property {string} Street + * @property {string} State + * @property {string} Country + */ + +// In interface mode, this file is likely to contain just comments. +// We add a dummy export statement to ensure it is recognised as an ES module. +export {}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/models.js index 9aa2efef9c1..df9ca0eefd7 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/models.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/models.js @@ -2,14 +2,8 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** - * @typedef {Object} Address - * @property {string} Street - * @property {string} State - * @property {string} Country + * @typedef {$models.Address} Address */ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/otherservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/otherservice.js index 6cec0768c3e..54aa155b97d 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/otherservice.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/otherservice.js @@ -14,7 +14,7 @@ import {Call as $Call} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Yay does this and that diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/greetservice.js index dfe6dfc50cb..48f69816463 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/greetservice.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/greetservice.js @@ -13,7 +13,7 @@ import {Call as $Call} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * @param {number[]} $in diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/internal.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/internal.js new file mode 100644 index 00000000000..ec6136e27b2 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/internal.js @@ -0,0 +1,14 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * @typedef {Object} Person + * @property {string} Name + * @property {Person | null} Parent + * @property {{"Age": number, "Address": {"Street": string}}} Details + */ + +// In interface mode, this file is likely to contain just comments. +// We add a dummy export statement to ensure it is recognised as an ES module. +export {}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/models.js index a08f855a065..0776019c7bf 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/models.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/models.js @@ -2,14 +2,8 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** - * @typedef {Object} Person - * @property {string} Name - * @property {Person | null} Parent - * @property {{"Age": number, "Address": {"Street": string}}} Details + * @typedef {$models.Person} Person */ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/greetservice.js index dfe6dfc50cb..48f69816463 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/greetservice.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/greetservice.js @@ -13,7 +13,7 @@ import {Call as $Call} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * @param {number[]} $in diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/internal.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/internal.js new file mode 100644 index 00000000000..ec6136e27b2 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/internal.js @@ -0,0 +1,14 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * @typedef {Object} Person + * @property {string} Name + * @property {Person | null} Parent + * @property {{"Age": number, "Address": {"Street": string}}} Details + */ + +// In interface mode, this file is likely to contain just comments. +// We add a dummy export statement to ensure it is recognised as an ES module. +export {}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/models.js index a08f855a065..0776019c7bf 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/models.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/models.js @@ -2,14 +2,8 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** - * @typedef {Object} Person - * @property {string} Name - * @property {Person | null} Parent - * @property {{"Age": number, "Address": {"Street": string}}} Details + * @typedef {$models.Person} Person */ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/greetservice.js index 0896a296de5..2a19fe849d2 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/greetservice.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/greetservice.js @@ -13,7 +13,7 @@ import {Call as $Call} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Greet does XYZ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/internal.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/internal.js new file mode 100644 index 00000000000..ab5cea25517 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/internal.js @@ -0,0 +1,19 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import * as services$0 from "./services/models.js"; + +/** + * Person is a person! + * They have a name and an address + * @typedef {Object} Person + * @property {string} Name + * @property {services$0.Address | null} Address + */ + +// In interface mode, this file is likely to contain just comments. +// We add a dummy export statement to ensure it is recognised as an ES module. +export {}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/models.js index 61451847c35..bb05b1c00d2 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/models.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/models.js @@ -2,19 +2,10 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as services$0 from "./services/models.js"; - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Person is a person! * They have a name and an address - * @typedef {Object} Person - * @property {string} Name - * @property {services$0.Address | null} Address + * @typedef {$models.Person} Person */ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/internal.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/internal.js new file mode 100644 index 00000000000..c04e3b10b1a --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/internal.js @@ -0,0 +1,14 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * @typedef {Object} Address + * @property {string} Street + * @property {string} State + * @property {string} Country + */ + +// In interface mode, this file is likely to contain just comments. +// We add a dummy export statement to ensure it is recognised as an ES module. +export {}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/models.js index 9aa2efef9c1..df9ca0eefd7 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/models.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/models.js @@ -2,14 +2,8 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** - * @typedef {Object} Address - * @property {string} Street - * @property {string} State - * @property {string} Country + * @typedef {$models.Address} Address */ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/otherservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/otherservice.js index 6b15c3e2221..d1dcf667709 100644 --- a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/otherservice.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/otherservice.js @@ -14,7 +14,7 @@ import {Call as $Call} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Yay does this and that diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/greetservice.ts index d1961395b6e..bbd4c1891bf 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/greetservice.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/greetservice.ts @@ -12,10 +12,10 @@ import {Call as $Call, Create as $Create} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** - * Get someone + * Get someone. */ export function Get(aliasValue: $models.Alias): Promise<$models.Person> & { cancel(): void } { let $resultPromise = $Call.ByID(1928502664, aliasValue) as any; @@ -27,7 +27,19 @@ export function Get(aliasValue: $models.Alias): Promise<$models.Person> & { canc } /** - * Get someone quite different + * Apparently, aliases are all the rage right now. + */ +export function GetButAliased(p: $models.AliasedPerson): Promise<$models.StrangelyAliasedPerson> & { cancel(): void } { + let $resultPromise = $Call.ByID(1896499664, p) as any; + let $typingPromise = $resultPromise.then(($result: any) => { + return $$createType0($result); + }) as any; + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +/** + * Get someone quite different. */ export function GetButDifferent(): Promise<$models.GenericPerson> & { cancel(): void } { let $resultPromise = $Call.ByID(2240931744) as any; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/internal.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/internal.ts new file mode 100644 index 00000000000..2501e921e05 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/internal.ts @@ -0,0 +1,157 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Create as $Create} from "/wails/runtime.js"; + +/** + * A nice type Alias. + */ +export type Alias = number; + +/** + * A struct alias. + * This should be rendered as a typedef or interface in every mode. + */ +export interface AliasStruct { + /** + * A field with a comment. + */ + "Foo": number[]; + + /** + * Definitely not Foo. + */ + "Bar"?: string; + "Baz"?: string; + + /** + * A nested alias struct. + */ + "Other": OtherAliasStruct; +} + +/** + * An empty struct alias. + */ +export interface EmptyAliasStruct { +} + +/** + * An empty struct. + */ +export class EmptyStruct { + + /** Creates a new EmptyStruct instance. */ + constructor($$source: Partial = {}) { + + Object.assign(this, $$source); + } + + /** + * Creates a new EmptyStruct instance from a string or object. + */ + static createFrom($$source: any = {}): EmptyStruct { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new EmptyStruct($$parsedSource as Partial); + } +} + +/** + * A generic struct containing an alias. + */ +export class GenericPerson { + "Name": T | null; + "AliasedField": Alias; + + /** Creates a new GenericPerson instance. */ + constructor($$source: Partial> = {}) { + if (!("Name" in $$source)) { + this["Name"] = null; + } + if (!("AliasedField" in $$source)) { + this["AliasedField"] = 0; + } + + Object.assign(this, $$source); + } + + /** + * Given creation functions for each type parameter, + * returns a creation function for a concrete instance + * of the generic class GenericPerson. + */ + static createFrom($$createParamT: (source: any) => T): ($$source?: any) => GenericPerson { + const $$createField0_0 = $$createParamT; + return ($$source: any = {}) => { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Name" in $$parsedSource) { + $$parsedSource["Name"] = $$createField0_0($$parsedSource["Name"]); + } + return new GenericPerson($$parsedSource as Partial>); + }; + } +} + +/** + * Another struct alias. + */ +export interface OtherAliasStruct { + "NoMoreIdeas": number[]; +} + +/** + * A non-generic struct containing an alias. + */ +export class Person { + /** + * The Person's name. + */ + "Name": string; + + /** + * A random alias field. + */ + "AliasedField": Alias; + + /** Creates a new Person instance. */ + constructor($$source: Partial = {}) { + if (!("Name" in $$source)) { + this["Name"] = ""; + } + if (!("AliasedField" in $$source)) { + this["AliasedField"] = 0; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + */ + static createFrom($$source: any = {}): Person { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new Person($$parsedSource as Partial); + } +} + +/** + * A class alias. + */ +export const AliasedPerson = Person; + +/** + * A class alias. + */ +export type AliasedPerson = Person; + +/** + * Another class alias, but ordered after its aliased class. + */ +export const StrangelyAliasedPerson = Person; + +/** + * Another class alias, but ordered after its aliased class. + */ +export type StrangelyAliasedPerson = Person; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/models.ts index cd813c39b9d..48ca89425e6 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/models.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/models.ts @@ -1,137 +1,17 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import {Create as $Create} from "/wails/runtime.js"; - -/** - * A nice type Alias - */ -export type Alias = number; - -/** - * A struct alias. - * This should be rendered as a typedef or interface in every mode. - */ -export interface AliasStruct { - /** - * A field with a comment. - */ - "Foo": number[]; - - /** - * Definitely not Foo. - */ - "Bar"?: string; - "Baz"?: string; - - /** - * A nested alias struct. - */ - "Other": OtherAliasStruct; -} - -/** - * An empty struct alias. - */ -export interface EmptyAliasStruct { -} - -/** - * An empty struct. - */ -export class EmptyStruct { - - /** Creates a new EmptyStruct instance. */ - constructor($$source: Partial = {}) { - - Object.assign(this, $$source); - } - - /** - * Creates a new EmptyStruct instance from a string or object. - */ - static createFrom($$source: any = {}): EmptyStruct { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - return new EmptyStruct($$parsedSource as Partial); - } -} - -/** - * A generic struct containing an alias - */ -export class GenericPerson { - "Name": T | null; - "AliasedField": Alias; - - /** Creates a new GenericPerson instance. */ - constructor($$source: Partial> = {}) { - if (!("Name" in $$source)) { - this["Name"] = null; - } - if (!("AliasedField" in $$source)) { - this["AliasedField"] = 0; - } - - Object.assign(this, $$source); - } - - /** - * Given creation functions for each type parameter, - * returns a creation function for a concrete instance - * of the generic class GenericPerson. - */ - static createFrom($$createParamT: (source: any) => T): ($$source?: any) => GenericPerson { - const $$createField0_0 = $$createParamT; - return ($$source: any = {}) => { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - if ("Name" in $$parsedSource) { - $$parsedSource["Name"] = $$createField0_0($$parsedSource["Name"]); - } - return new GenericPerson($$parsedSource as Partial>); - }; - } -} - -/** - * Another struct alias. - */ -export interface OtherAliasStruct { - "NoMoreIdeas": number[]; -} - -/** - * A non-generic struct containing an alias. - */ -export class Person { - /** - * The Person's name. - */ - "Name": string; - - /** - * A random alias field. - */ - "AliasedField": Alias; - - /** Creates a new Person instance. */ - constructor($$source: Partial = {}) { - if (!("Name" in $$source)) { - this["Name"] = ""; - } - if (!("AliasedField" in $$source)) { - this["AliasedField"] = 0; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new Person instance from a string or object. - */ - static createFrom($$source: any = {}): Person { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - return new Person($$parsedSource as Partial); - } -} +export { + AliasedPerson, + EmptyStruct, + GenericPerson, + Person, + StrangelyAliasedPerson +} from "./internal.js"; + +export type { + Alias, + AliasStruct, + EmptyAliasStruct, + OtherAliasStruct +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/greetservice.ts index 3816bcdeebc..7e83e922f86 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/greetservice.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/greetservice.ts @@ -12,7 +12,7 @@ import {Call as $Call, Create as $Create} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Greet does XYZ diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/internal.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/internal.ts index a0b9ce4c2cc..026a31d2e46 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/internal.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/internal.ts @@ -5,6 +5,195 @@ // @ts-ignore: Unused imports import {Create as $Create} from "/wails/runtime.js"; +export class Embedded1 { + /** + * Friends should be shadowed in Person by a field of lesser depth + */ + "Friends": number; + + /** + * Vanish should be omitted from Person because there is another field with same depth and no tag + */ + "Vanish": number; + + /** + * StillThere should be shadowed in Person by other field with same depth and a json tag + */ + "StillThere": string; + + /** + * NamingThingsIsHard is a law of programming + */ + "NamingThingsIsHard": `${boolean}`; + + /** Creates a new Embedded1 instance. */ + constructor($$source: Partial = {}) { + if (!("Friends" in $$source)) { + this["Friends"] = 0; + } + if (!("Vanish" in $$source)) { + this["Vanish"] = 0; + } + if (!("StillThere" in $$source)) { + this["StillThere"] = ""; + } + if (!("NamingThingsIsHard" in $$source)) { + this["NamingThingsIsHard"] = "false"; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Embedded1 instance from a string or object. + */ + static createFrom($$source: any = {}): Embedded1 { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new Embedded1($$parsedSource as Partial); + } +} + +export type Embedded3 = string; + +/** + * Person represents a person + */ +export class Person { + /** + * Titles is optional in JSON + */ + "Titles"?: Title[]; + + /** + * Names has a + * multiline comment + */ + "Names": string[]; + + /** + * Partner has a custom and complex JSON key + */ + "Partner": Person | null; + "Friends": (Person | null)[]; + + /** + * NamingThingsIsHard is a law of programming + */ + "NamingThingsIsHard": `${boolean}`; + + /** + * StillThereButRenamed should shadow in Person the other field with same depth and no json tag + */ + "StillThere": Embedded3 | null; + + /** + * StrangeNumber maps to "-" + */ + "-": number; + + /** + * Embedded3 should appear with key "Embedded3" + */ + "Embedded3": Embedded3; + + /** + * StrangerNumber is serialized as a string + */ + "StrangerNumber": `${number}`; + + /** + * StrangestString is optional and serialized as a JSON string + */ + "StrangestString"?: `"${string}"`; + + /** + * StringStrangest is serialized as a JSON string and optional + */ + "StringStrangest"?: `"${string}"`; + + /** + * embedded4 should be optional and appear with key "emb4" + */ + "emb4"?: embedded4; + + /** Creates a new Person instance. */ + constructor($$source: Partial = {}) { + if (!("Names" in $$source)) { + this["Names"] = []; + } + if (!("Partner" in $$source)) { + this["Partner"] = null; + } + if (!("Friends" in $$source)) { + this["Friends"] = []; + } + if (!("NamingThingsIsHard" in $$source)) { + this["NamingThingsIsHard"] = "false"; + } + if (!("StillThere" in $$source)) { + this["StillThere"] = null; + } + if (!("-" in $$source)) { + this["-"] = 0; + } + if (!("Embedded3" in $$source)) { + this["Embedded3"] = ("" as Embedded3); + } + if (!("StrangerNumber" in $$source)) { + this["StrangerNumber"] = "0"; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + */ + static createFrom($$source: any = {}): Person { + const $$createField0_0 = $$createType0; + const $$createField1_0 = $$createType1; + const $$createField2_0 = $$createType3; + const $$createField3_0 = $$createType4; + const $$createField11_0 = $$createType5; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Titles" in $$parsedSource) { + $$parsedSource["Titles"] = $$createField0_0($$parsedSource["Titles"]); + } + if ("Names" in $$parsedSource) { + $$parsedSource["Names"] = $$createField1_0($$parsedSource["Names"]); + } + if ("Partner" in $$parsedSource) { + $$parsedSource["Partner"] = $$createField2_0($$parsedSource["Partner"]); + } + if ("Friends" in $$parsedSource) { + $$parsedSource["Friends"] = $$createField3_0($$parsedSource["Friends"]); + } + if ("emb4" in $$parsedSource) { + $$parsedSource["emb4"] = $$createField11_0($$parsedSource["emb4"]); + } + return new Person($$parsedSource as Partial); + } +} + +/** + * Title is a title + */ +export enum Title { + /** + * The Go zero value for the underlying type of the enum. + */ + $zero = "", + + /** + * Mister is a title + */ + Mister = "Mr", + Miss = "Miss", + Ms = "Ms", + Mrs = "Mrs", + Dr = "Dr", +}; + export class embedded4 { /** * NamingThingsIsHard is a law of programming @@ -38,3 +227,11 @@ export class embedded4 { return new embedded4($$parsedSource as Partial); } } + +// Private type creation functions +const $$createType0 = $Create.Array($Create.Any); +const $$createType1 = $Create.Array($Create.Any); +const $$createType2 = Person.createFrom; +const $$createType3 = $Create.Nullable($$createType2); +const $$createType4 = $Create.Array($$createType3); +const $$createType5 = embedded4.createFrom; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/models.ts index 11fdefc27e6..56a4bb6596c 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/models.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/models.ts @@ -1,207 +1,12 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import {Create as $Create} from "/wails/runtime.js"; - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as $internal from "./internal.js"; - -export class Embedded1 { - /** - * Friends should be shadowed in Person by a field of lesser depth - */ - "Friends": number; - - /** - * Vanish should be omitted from Person because there is another field with same depth and no tag - */ - "Vanish": number; - - /** - * StillThere should be shadowed in Person by other field with same depth and a json tag - */ - "StillThere": string; - - /** - * NamingThingsIsHard is a law of programming - */ - "NamingThingsIsHard": `${boolean}`; - - /** Creates a new Embedded1 instance. */ - constructor($$source: Partial = {}) { - if (!("Friends" in $$source)) { - this["Friends"] = 0; - } - if (!("Vanish" in $$source)) { - this["Vanish"] = 0; - } - if (!("StillThere" in $$source)) { - this["StillThere"] = ""; - } - if (!("NamingThingsIsHard" in $$source)) { - this["NamingThingsIsHard"] = "false"; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new Embedded1 instance from a string or object. - */ - static createFrom($$source: any = {}): Embedded1 { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - return new Embedded1($$parsedSource as Partial); - } -} - -export type Embedded3 = string; - -/** - * Person represents a person - */ -export class Person { - /** - * Titles is optional in JSON - */ - "Titles"?: Title[]; - - /** - * Names has a - * multiline comment - */ - "Names": string[]; - - /** - * Partner has a custom and complex JSON key - */ - "Partner": Person | null; - "Friends": (Person | null)[]; - - /** - * NamingThingsIsHard is a law of programming - */ - "NamingThingsIsHard": `${boolean}`; - - /** - * StillThereButRenamed should shadow in Person the other field with same depth and no json tag - */ - "StillThere": Embedded3 | null; - - /** - * StrangeNumber maps to "-" - */ - "-": number; - - /** - * Embedded3 should appear with key "Embedded3" - */ - "Embedded3": Embedded3; - - /** - * StrangerNumber is serialized as a string - */ - "StrangerNumber": `${number}`; - - /** - * StrangestString is optional and serialized as a JSON string - */ - "StrangestString"?: `"${string}"`; - - /** - * StringStrangest is serialized as a JSON string and optional - */ - "StringStrangest"?: `"${string}"`; - - /** - * embedded4 should be optional and appear with key "emb4" - */ - "emb4"?: $internal.embedded4; - - /** Creates a new Person instance. */ - constructor($$source: Partial = {}) { - if (!("Names" in $$source)) { - this["Names"] = []; - } - if (!("Partner" in $$source)) { - this["Partner"] = null; - } - if (!("Friends" in $$source)) { - this["Friends"] = []; - } - if (!("NamingThingsIsHard" in $$source)) { - this["NamingThingsIsHard"] = "false"; - } - if (!("StillThere" in $$source)) { - this["StillThere"] = null; - } - if (!("-" in $$source)) { - this["-"] = 0; - } - if (!("Embedded3" in $$source)) { - this["Embedded3"] = ("" as Embedded3); - } - if (!("StrangerNumber" in $$source)) { - this["StrangerNumber"] = "0"; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new Person instance from a string or object. - */ - static createFrom($$source: any = {}): Person { - const $$createField0_0 = $$createType0; - const $$createField1_0 = $$createType1; - const $$createField2_0 = $$createType3; - const $$createField3_0 = $$createType4; - const $$createField11_0 = $$createType5; - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - if ("Titles" in $$parsedSource) { - $$parsedSource["Titles"] = $$createField0_0($$parsedSource["Titles"]); - } - if ("Names" in $$parsedSource) { - $$parsedSource["Names"] = $$createField1_0($$parsedSource["Names"]); - } - if ("Partner" in $$parsedSource) { - $$parsedSource["Partner"] = $$createField2_0($$parsedSource["Partner"]); - } - if ("Friends" in $$parsedSource) { - $$parsedSource["Friends"] = $$createField3_0($$parsedSource["Friends"]); - } - if ("emb4" in $$parsedSource) { - $$parsedSource["emb4"] = $$createField11_0($$parsedSource["emb4"]); - } - return new Person($$parsedSource as Partial); - } -} - -/** - * Title is a title - */ -export enum Title { - /** - * The Go zero value for the underlying type of the enum. - */ - $zero = "", - - /** - * Mister is a title - */ - Mister = "Mr", - Miss = "Miss", - Ms = "Ms", - Mrs = "Mrs", - Dr = "Dr", -}; - -// Private type creation functions -const $$createType0 = $Create.Array($Create.Any); -const $$createType1 = $Create.Array($Create.Any); -const $$createType2 = Person.createFrom; -const $$createType3 = $Create.Nullable($$createType2); -const $$createType4 = $Create.Array($$createType3); -const $$createType5 = $internal.embedded4.createFrom; +export { + Embedded1, + Person, + Title +} from "./internal.js"; + +export type { + Embedded3 +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/greetservice.ts index fb057998c5e..293f1df5a19 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/greetservice.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/greetservice.ts @@ -12,7 +12,7 @@ import {Call as $Call, Create as $Create} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Greet does XYZ diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/internal.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/internal.ts new file mode 100644 index 00000000000..66dc1409230 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/internal.ts @@ -0,0 +1,30 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Create as $Create} from "/wails/runtime.js"; + +/** + * Person represents a person + */ +export class Person { + "Name": string; + + /** Creates a new Person instance. */ + constructor($$source: Partial = {}) { + if (!("Name" in $$source)) { + this["Name"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + */ + static createFrom($$source: any = {}): Person { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new Person($$parsedSource as Partial); + } +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/models.ts index 66dc1409230..af848881144 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/models.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/models.ts @@ -1,30 +1,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import {Create as $Create} from "/wails/runtime.js"; - -/** - * Person represents a person - */ -export class Person { - "Name": string; - - /** Creates a new Person instance. */ - constructor($$source: Partial = {}) { - if (!("Name" in $$source)) { - this["Name"] = ""; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new Person instance from a string or object. - */ - static createFrom($$source: any = {}): Person { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - return new Person($$parsedSource as Partial); - } -} +export { + Person +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/greetservice.ts new file mode 100644 index 00000000000..eb06129b7c0 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/greetservice.ts @@ -0,0 +1,33 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import * as $models from "./internal.js"; + +/** + * Make a cycle. + */ +export function MakeCycles(): Promise<[$models.StructA, $models.StructC]> & { cancel(): void } { + let $resultPromise = $Call.ByID(440020721) as any; + let $typingPromise = $resultPromise.then(($result: any) => { + $result[0] = $$createType0($result[0]); + $result[1] = $$createType1($result[1]); + return $result; + }) as any; + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +// Private type creation functions +const $$createType0 = $models.StructA.createFrom; +const $$createType1 = $models.StructC.createFrom; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/index.ts similarity index 100% rename from v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/index.ts rename to v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/index.ts diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/internal.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/internal.ts new file mode 100644 index 00000000000..a79d42f3294 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/internal.ts @@ -0,0 +1,131 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Create as $Create} from "/wails/runtime.js"; + +export class StructA { + "B": structB | null; + + /** Creates a new StructA instance. */ + constructor($$source: Partial = {}) { + if (!("B" in $$source)) { + this["B"] = null; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new StructA instance from a string or object. + */ + static createFrom($$source: any = {}): StructA { + const $$createField0_0 = $$createType1; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("B" in $$parsedSource) { + $$parsedSource["B"] = $$createField0_0($$parsedSource["B"]); + } + return new StructA($$parsedSource as Partial); + } +} + +export class StructC { + "D": structD; + + /** Creates a new StructC instance. */ + constructor($$source: Partial = {}) { + if (!("D" in $$source)) { + this["D"] = (new structD()); + } + + Object.assign(this, $$source); + } + + /** + * Creates a new StructC instance from a string or object. + */ + static createFrom($$source: any = {}): StructC { + const $$createField0_0 = $$createType2; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("D" in $$parsedSource) { + $$parsedSource["D"] = $$createField0_0($$parsedSource["D"]); + } + return new StructC($$parsedSource as Partial); + } +} + +export class StructE { + + /** Creates a new StructE instance. */ + constructor($$source: Partial = {}) { + + Object.assign(this, $$source); + } + + /** + * Creates a new StructE instance from a string or object. + */ + static createFrom($$source: any = {}): StructE { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new StructE($$parsedSource as Partial); + } +} + +export class structB { + "A": StructA | null; + + /** Creates a new structB instance. */ + constructor($$source: Partial = {}) { + if (!("A" in $$source)) { + this["A"] = null; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new structB instance from a string or object. + */ + static createFrom($$source: any = {}): structB { + const $$createField0_0 = $$createType4; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("A" in $$parsedSource) { + $$parsedSource["A"] = $$createField0_0($$parsedSource["A"]); + } + return new structB($$parsedSource as Partial); + } +} + +export class structD { + "E": StructE; + + /** Creates a new structD instance. */ + constructor($$source: Partial = {}) { + if (!("E" in $$source)) { + this["E"] = (new StructE()); + } + + Object.assign(this, $$source); + } + + /** + * Creates a new structD instance from a string or object. + */ + static createFrom($$source: any = {}): structD { + const $$createField0_0 = $$createType5; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("E" in $$parsedSource) { + $$parsedSource["E"] = $$createField0_0($$parsedSource["E"]); + } + return new structD($$parsedSource as Partial); + } +} + +// Private type creation functions +const $$createType0 = structB.createFrom; +const $$createType1 = $Create.Nullable($$createType0); +const $$createType2 = structD.createFrom; +const $$createType3 = StructA.createFrom; +const $$createType4 = $Create.Nullable($$createType3); +const $$createType5 = StructE.createFrom; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/models.ts new file mode 100644 index 00000000000..f6997135d06 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/models.ts @@ -0,0 +1,8 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +export { + StructA, + StructC, + StructE +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/greetservice.ts similarity index 98% rename from v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/greetservice.ts rename to v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/greetservice.ts index 26782f46bb7..2453e2db634 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/greetservice.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/greetservice.ts @@ -12,7 +12,7 @@ import {Call as $Call, Create as $Create} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Make a cycle. diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/index.ts similarity index 100% rename from v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/index.ts rename to v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/index.ts diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/internal.ts similarity index 100% rename from v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/models.ts rename to v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/internal.ts diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/models.ts new file mode 100644 index 00000000000..e4c8045036d --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/models.ts @@ -0,0 +1,8 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +export type { + Alias, + Cyclic, + GenericCyclic +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/greetservice.ts index da5d96205cf..e38c8bcd715 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/greetservice.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/greetservice.ts @@ -12,7 +12,7 @@ import {Call as $Call, Create as $Create} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Greet does XYZ diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/internal.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/internal.ts new file mode 100644 index 00000000000..bc7cd496495 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/internal.ts @@ -0,0 +1,53 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Create as $Create} from "/wails/runtime.js"; + +/** + * Person represents a person + */ +export class Person { + "Title": Title; + "Name": string; + + /** Creates a new Person instance. */ + constructor($$source: Partial = {}) { + if (!("Title" in $$source)) { + this["Title"] = ("" as Title); + } + if (!("Name" in $$source)) { + this["Name"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + */ + static createFrom($$source: any = {}): Person { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new Person($$parsedSource as Partial); + } +} + +/** + * Title is a title + */ +export enum Title { + /** + * The Go zero value for the underlying type of the enum. + */ + $zero = "", + + /** + * Mister is a title + */ + Mister = "Mr", + Miss = "Miss", + Ms = "Ms", + Mrs = "Mrs", + Dr = "Dr", +}; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/models.ts index bc7cd496495..728210dfb52 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/models.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/models.ts @@ -1,53 +1,7 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import {Create as $Create} from "/wails/runtime.js"; - -/** - * Person represents a person - */ -export class Person { - "Title": Title; - "Name": string; - - /** Creates a new Person instance. */ - constructor($$source: Partial = {}) { - if (!("Title" in $$source)) { - this["Title"] = ("" as Title); - } - if (!("Name" in $$source)) { - this["Name"] = ""; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new Person instance from a string or object. - */ - static createFrom($$source: any = {}): Person { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - return new Person($$parsedSource as Partial); - } -} - -/** - * Title is a title - */ -export enum Title { - /** - * The Go zero value for the underlying type of the enum. - */ - $zero = "", - - /** - * Mister is a title - */ - Mister = "Mr", - Miss = "Miss", - Ms = "Ms", - Mrs = "Mrs", - Dr = "Dr", -}; +export { + Person, + Title +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/internal.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/internal.ts new file mode 100644 index 00000000000..335543dbbb8 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/internal.ts @@ -0,0 +1,22 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Create as $Create} from "/wails/runtime.js"; + +export enum Title { + /** + * The Go zero value for the underlying type of the enum. + */ + $zero = "", + + /** + * Mister is a title + */ + Mister = "Mr", + Miss = "Miss", + Ms = "Ms", + Mrs = "Mrs", + Dr = "Dr", +}; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/models.ts index 335543dbbb8..e8981fc5e89 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/models.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/models.ts @@ -1,22 +1,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import {Create as $Create} from "/wails/runtime.js"; - -export enum Title { - /** - * The Go zero value for the underlying type of the enum. - */ - $zero = "", - - /** - * Mister is a title - */ - Mister = "Mr", - Miss = "Miss", - Ms = "Ms", - Mrs = "Mrs", - Dr = "Dr", -}; +export { + Title +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/greetservice.ts index 07b718c9979..9dec152c9b6 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/greetservice.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/greetservice.ts @@ -12,7 +12,7 @@ import {Call as $Call, Create as $Create} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Greet does XYZ diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/internal.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/internal.ts new file mode 100644 index 00000000000..02707e2caa9 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/internal.ts @@ -0,0 +1,46 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Create as $Create} from "/wails/runtime.js"; + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import * as services$0 from "./services/models.js"; + +/** + * Person is a person + */ +export class Person { + "Name": string; + "Address": services$0.Address | null; + + /** Creates a new Person instance. */ + constructor($$source: Partial = {}) { + if (!("Name" in $$source)) { + this["Name"] = ""; + } + if (!("Address" in $$source)) { + this["Address"] = null; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + */ + static createFrom($$source: any = {}): Person { + const $$createField1_0 = $$createType1; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Address" in $$parsedSource) { + $$parsedSource["Address"] = $$createField1_0($$parsedSource["Address"]); + } + return new Person($$parsedSource as Partial); + } +} + +// Private type creation functions +const $$createType0 = services$0.Address.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/models.ts index 02707e2caa9..af848881144 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/models.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/models.ts @@ -1,46 +1,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import {Create as $Create} from "/wails/runtime.js"; - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as services$0 from "./services/models.js"; - -/** - * Person is a person - */ -export class Person { - "Name": string; - "Address": services$0.Address | null; - - /** Creates a new Person instance. */ - constructor($$source: Partial = {}) { - if (!("Name" in $$source)) { - this["Name"] = ""; - } - if (!("Address" in $$source)) { - this["Address"] = null; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new Person instance from a string or object. - */ - static createFrom($$source: any = {}): Person { - const $$createField1_0 = $$createType1; - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - if ("Address" in $$parsedSource) { - $$parsedSource["Address"] = $$createField1_0($$parsedSource["Address"]); - } - return new Person($$parsedSource as Partial); - } -} - -// Private type creation functions -const $$createType0 = services$0.Address.createFrom; -const $$createType1 = $Create.Nullable($$createType0); +export { + Person +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/internal.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/internal.ts new file mode 100644 index 00000000000..eb9c1b6bf51 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/internal.ts @@ -0,0 +1,35 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Create as $Create} from "/wails/runtime.js"; + +export class Address { + "Street": string; + "State": string; + "Country": string; + + /** Creates a new Address instance. */ + constructor($$source: Partial
= {}) { + if (!("Street" in $$source)) { + this["Street"] = ""; + } + if (!("State" in $$source)) { + this["State"] = ""; + } + if (!("Country" in $$source)) { + this["Country"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Address instance from a string or object. + */ + static createFrom($$source: any = {}): Address { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new Address($$parsedSource as Partial
); + } +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/models.ts index eb9c1b6bf51..82637788023 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/models.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/models.ts @@ -1,35 +1,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import {Create as $Create} from "/wails/runtime.js"; - -export class Address { - "Street": string; - "State": string; - "Country": string; - - /** Creates a new Address instance. */ - constructor($$source: Partial
= {}) { - if (!("Street" in $$source)) { - this["Street"] = ""; - } - if (!("State" in $$source)) { - this["State"] = ""; - } - if (!("Country" in $$source)) { - this["Country"] = ""; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new Address instance from a string or object. - */ - static createFrom($$source: any = {}): Address { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - return new Address($$parsedSource as Partial
); - } -} +export { + Address +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/otherservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/otherservice.ts index 13a82546ae8..4c60bda3232 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/otherservice.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/otherservice.ts @@ -13,7 +13,7 @@ import {Call as $Call, Create as $Create} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Yay does this and that diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/greetservice.ts index 07b718c9979..9dec152c9b6 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/greetservice.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/greetservice.ts @@ -12,7 +12,7 @@ import {Call as $Call, Create as $Create} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Greet does XYZ diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/internal.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/internal.ts new file mode 100644 index 00000000000..c4a6d39ee62 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/internal.ts @@ -0,0 +1,43 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Create as $Create} from "/wails/runtime.js"; + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import * as other$0 from "./services/other/models.js"; + +export class Person { + "Name": string; + "Address": other$0.Address | null; + + /** Creates a new Person instance. */ + constructor($$source: Partial = {}) { + if (!("Name" in $$source)) { + this["Name"] = ""; + } + if (!("Address" in $$source)) { + this["Address"] = null; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + */ + static createFrom($$source: any = {}): Person { + const $$createField1_0 = $$createType1; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Address" in $$parsedSource) { + $$parsedSource["Address"] = $$createField1_0($$parsedSource["Address"]); + } + return new Person($$parsedSource as Partial); + } +} + +// Private type creation functions +const $$createType0 = other$0.Address.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/models.ts index c4a6d39ee62..af848881144 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/models.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/models.ts @@ -1,43 +1,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import {Create as $Create} from "/wails/runtime.js"; - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as other$0 from "./services/other/models.js"; - -export class Person { - "Name": string; - "Address": other$0.Address | null; - - /** Creates a new Person instance. */ - constructor($$source: Partial = {}) { - if (!("Name" in $$source)) { - this["Name"] = ""; - } - if (!("Address" in $$source)) { - this["Address"] = null; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new Person instance from a string or object. - */ - static createFrom($$source: any = {}): Person { - const $$createField1_0 = $$createType1; - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - if ("Address" in $$parsedSource) { - $$parsedSource["Address"] = $$createField1_0($$parsedSource["Address"]); - } - return new Person($$parsedSource as Partial); - } -} - -// Private type creation functions -const $$createType0 = other$0.Address.createFrom; -const $$createType1 = $Create.Nullable($$createType0); +export { + Person +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/internal.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/internal.ts new file mode 100644 index 00000000000..eb9c1b6bf51 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/internal.ts @@ -0,0 +1,35 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Create as $Create} from "/wails/runtime.js"; + +export class Address { + "Street": string; + "State": string; + "Country": string; + + /** Creates a new Address instance. */ + constructor($$source: Partial
= {}) { + if (!("Street" in $$source)) { + this["Street"] = ""; + } + if (!("State" in $$source)) { + this["State"] = ""; + } + if (!("Country" in $$source)) { + this["Country"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Address instance from a string or object. + */ + static createFrom($$source: any = {}): Address { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new Address($$parsedSource as Partial
); + } +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/models.ts index eb9c1b6bf51..82637788023 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/models.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/models.ts @@ -1,35 +1,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import {Create as $Create} from "/wails/runtime.js"; - -export class Address { - "Street": string; - "State": string; - "Country": string; - - /** Creates a new Address instance. */ - constructor($$source: Partial
= {}) { - if (!("Street" in $$source)) { - this["Street"] = ""; - } - if (!("State" in $$source)) { - this["State"] = ""; - } - if (!("Country" in $$source)) { - this["Country"] = ""; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new Address instance from a string or object. - */ - static createFrom($$source: any = {}): Address { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - return new Address($$parsedSource as Partial
); - } -} +export { + Address +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/otherservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/otherservice.ts index f3c4c0c4352..09e95686d56 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/otherservice.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/otherservice.ts @@ -13,7 +13,7 @@ import {Call as $Call, Create as $Create} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Yay does this and that diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_internal/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_internal/greetservice.ts new file mode 100644 index 00000000000..b14533c7b33 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_internal/greetservice.ts @@ -0,0 +1,19 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * Greet someone + */ +export function Greet(name: string): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1411160069, name) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_internal/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_internal/index.ts new file mode 100644 index 00000000000..50e3f043598 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_internal/index.ts @@ -0,0 +1,7 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/internal.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/internal.ts index 13723a54993..da359b2834f 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/internal.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/internal.ts @@ -5,6 +5,103 @@ // @ts-ignore: Unused imports import {Create as $Create} from "/wails/runtime.js"; +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import * as other$0 from "./other/models.js"; + +/** + * HowDifferent is a curious kind of person + * that lets other people decide how they are different. + */ +export class HowDifferent { + /** + * They have a name as well. + */ + "Name": string; + + /** + * But they may have many differences. + */ + "Differences": { [_: string]: How | null }[]; + + /** Creates a new HowDifferent instance. */ + constructor($$source: Partial> = {}) { + if (!("Name" in $$source)) { + this["Name"] = ""; + } + if (!("Differences" in $$source)) { + this["Differences"] = []; + } + + Object.assign(this, $$source); + } + + /** + * Given creation functions for each type parameter, + * returns a creation function for a concrete instance + * of the generic class HowDifferent. + */ + static createFrom($$createParamHow: (source: any) => How): ($$source?: any) => HowDifferent { + const $$createField1_0 = $$createType1($$createParamHow); + return ($$source: any = {}) => { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Differences" in $$parsedSource) { + $$parsedSource["Differences"] = $$createField1_0($$parsedSource["Differences"]); + } + return new HowDifferent($$parsedSource as Partial>); + }; + } +} + +/** + * Impersonator gets their fields from other people. + */ +export const Impersonator = other$0.OtherPerson; + +/** + * Impersonator gets their fields from other people. + */ +export type Impersonator = other$0.OtherPerson; + +/** + * Person is not a number. + */ +export class Person { + /** + * They have a name. + */ + "Name": string; + + /** + * Exactly 4 sketchy friends. + */ + "Friends": Impersonator[]; + + /** Creates a new Person instance. */ + constructor($$source: Partial = {}) { + if (!("Name" in $$source)) { + this["Name"] = ""; + } + if (!("Friends" in $$source)) { + this["Friends"] = Array.from({ length: 4 }, () => (new Impersonator())); + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + */ + static createFrom($$source: any = {}): Person { + const $$createField1_0 = $$createType3; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Friends" in $$parsedSource) { + $$parsedSource["Friends"] = $$createField1_0($$parsedSource["Friends"]); + } + return new Person($$parsedSource as Partial); + } +} + export class personImpl { /** * Nickname conceals a person's identity. @@ -16,6 +113,11 @@ export class personImpl { */ "Name": string; + /** + * Exactly 4 sketchy friends. + */ + "Friends": Impersonator[]; + /** Creates a new personImpl instance. */ constructor($$source: Partial = {}) { if (!("Nickname" in $$source)) { @@ -24,6 +126,9 @@ export class personImpl { if (!("Name" in $$source)) { this["Name"] = ""; } + if (!("Friends" in $$source)) { + this["Friends"] = Array.from({ length: 4 }, () => (new Impersonator())); + } Object.assign(this, $$source); } @@ -32,7 +137,27 @@ export class personImpl { * Creates a new personImpl instance from a string or object. */ static createFrom($$source: any = {}): personImpl { + const $$createField2_0 = $$createType3; let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Friends" in $$parsedSource) { + $$parsedSource["Friends"] = $$createField2_0($$parsedSource["Friends"]); + } return new personImpl($$parsedSource as Partial); } } + +/** + * PrivatePerson gets their fields from hidden sources. + */ +export const PrivatePerson = personImpl; + +/** + * PrivatePerson gets their fields from hidden sources. + */ +export type PrivatePerson = personImpl; + +// Private type creation functions +const $$createType0 = ($$createParamHow) => $Create.Map($Create.Any, $$createParamHow); +const $$createType1 = ($$createParamHow) => $Create.Array($$createType0($$createParamHow)); +const $$createType2 = Impersonator.createFrom; +const $$createType3 = $Create.Array($$createType2); diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/models.ts index 7bb043fe601..8f1e3431141 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/models.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/models.ts @@ -1,109 +1,9 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import {Create as $Create} from "/wails/runtime.js"; - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as other$0 from "./other/models.js"; - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as $internal from "./internal.js"; - -/** - * HowDifferent is a curious kind of person - * that lets other people decide how they are different. - */ -export class HowDifferent { - /** - * They have a name as well. - */ - "Name": string; - - /** - * But they may have many differences. - */ - "Differences": { [_: string]: How | null }[]; - - /** Creates a new HowDifferent instance. */ - constructor($$source: Partial> = {}) { - if (!("Name" in $$source)) { - this["Name"] = ""; - } - if (!("Differences" in $$source)) { - this["Differences"] = []; - } - - Object.assign(this, $$source); - } - - /** - * Given creation functions for each type parameter, - * returns a creation function for a concrete instance - * of the generic class HowDifferent. - */ - static createFrom($$createParamHow: (source: any) => How): ($$source?: any) => HowDifferent { - const $$createField1_0 = $$createType1($$createParamHow); - return ($$source: any = {}) => { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - if ("Differences" in $$parsedSource) { - $$parsedSource["Differences"] = $$createField1_0($$parsedSource["Differences"]); - } - return new HowDifferent($$parsedSource as Partial>); - }; - } -} - -/** - * Impersonator gets their fields from other people. - */ -export const Impersonator = other$0.OtherPerson; - -/** - * Impersonator gets their fields from other people. - */ -export type Impersonator = other$0.OtherPerson; - -/** - * Person is not a number. - */ -export class Person { - /** - * They have a name. - */ - "Name": string; - - /** Creates a new Person instance. */ - constructor($$source: Partial = {}) { - if (!("Name" in $$source)) { - this["Name"] = ""; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new Person instance from a string or object. - */ - static createFrom($$source: any = {}): Person { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - return new Person($$parsedSource as Partial); - } -} - -/** - * PrivatePerson gets their fields from hidden sources. - */ -export const PrivatePerson = $internal.personImpl; - -/** - * PrivatePerson gets their fields from hidden sources. - */ -export type PrivatePerson = $internal.personImpl; - -// Private type creation functions -const $$createType0 = ($$createParamHow) => $Create.Map($Create.Any, $$createParamHow); -const $$createType1 = ($$createParamHow) => $Create.Array($$createType0($$createParamHow)); +export { + HowDifferent, + Impersonator, + Person, + PrivatePerson +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/internal.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/internal.ts new file mode 100644 index 00000000000..59343c53e2f --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/internal.ts @@ -0,0 +1,52 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Create as $Create} from "/wails/runtime.js"; + +/** + * OtherPerson is like a person, but different. + */ +export class OtherPerson { + /** + * They have a name as well. + */ + "Name": string; + + /** + * But they may have many differences. + */ + "Differences": (T | null)[]; + + /** Creates a new OtherPerson instance. */ + constructor($$source: Partial> = {}) { + if (!("Name" in $$source)) { + this["Name"] = ""; + } + if (!("Differences" in $$source)) { + this["Differences"] = []; + } + + Object.assign(this, $$source); + } + + /** + * Given creation functions for each type parameter, + * returns a creation function for a concrete instance + * of the generic class OtherPerson. + */ + static createFrom($$createParamT: (source: any) => T): ($$source?: any) => OtherPerson { + const $$createField1_0 = $$createType0($$createParamT); + return ($$source: any = {}) => { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Differences" in $$parsedSource) { + $$parsedSource["Differences"] = $$createField1_0($$parsedSource["Differences"]); + } + return new OtherPerson($$parsedSource as Partial>); + }; + } +} + +// Private type creation functions +const $$createType0 = ($$createParamT) => $Create.Array($$createParamT); diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/models.ts index 59343c53e2f..01eb4cbda56 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/models.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/models.ts @@ -1,52 +1,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import {Create as $Create} from "/wails/runtime.js"; - -/** - * OtherPerson is like a person, but different. - */ -export class OtherPerson { - /** - * They have a name as well. - */ - "Name": string; - - /** - * But they may have many differences. - */ - "Differences": (T | null)[]; - - /** Creates a new OtherPerson instance. */ - constructor($$source: Partial> = {}) { - if (!("Name" in $$source)) { - this["Name"] = ""; - } - if (!("Differences" in $$source)) { - this["Differences"] = []; - } - - Object.assign(this, $$source); - } - - /** - * Given creation functions for each type parameter, - * returns a creation function for a concrete instance - * of the generic class OtherPerson. - */ - static createFrom($$createParamT: (source: any) => T): ($$source?: any) => OtherPerson { - const $$createField1_0 = $$createType0($$createParamT); - return ($$source: any = {}) => { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - if ("Differences" in $$parsedSource) { - $$parsedSource["Differences"] = $$createField1_0($$parsedSource["Differences"]); - } - return new OtherPerson($$parsedSource as Partial>); - }; - } -} - -// Private type creation functions -const $$createType0 = ($$createParamT) => $Create.Array($$createParamT); +export { + OtherPerson +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/somemethods.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/somemethods.ts index 3478edef9fa..15835c7fff0 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/somemethods.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/somemethods.ts @@ -12,18 +12,17 @@ import {Call as $Call, Create as $Create} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * LikeThisOne is an example method that does nothing. */ -export function LikeThisOne(): Promise<[$models.Person, $models.Impersonator, $models.HowDifferent, $models.PrivatePerson]> & { cancel(): void } { +export function LikeThisOne(): Promise<[$models.Person, $models.HowDifferent, $models.PrivatePerson]> & { cancel(): void } { let $resultPromise = $Call.ByID(2124352079) as any; let $typingPromise = $resultPromise.then(($result: any) => { $result[0] = $$createType0($result[0]); $result[1] = $$createType1($result[1]); $result[2] = $$createType2($result[2]); - $result[3] = $$createType3($result[3]); return $result; }) as any; $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); @@ -40,6 +39,5 @@ export function LikeThisOtherOne(): Promise & { cancel(): void } { // Private type creation functions const $$createType0 = $models.Person.createFrom; -const $$createType1 = $models.Impersonator.createFrom; -const $$createType2 = $models.HowDifferent.createFrom($Create.Any); -const $$createType3 = $models.PrivatePerson.createFrom; +const $$createType1 = $models.HowDifferent.createFrom($Create.Any); +const $$createType2 = $models.PrivatePerson.createFrom; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/embedservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/embedservice.ts index dd507b2815c..fa47d72a324 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/embedservice.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/embedservice.ts @@ -17,13 +17,12 @@ import * as nobindingshere$0 from "../no_bindings_here/models.js"; /** * LikeThisOne is an example method that does nothing. */ -export function LikeThisOne(): Promise<[nobindingshere$0.Person, nobindingshere$0.Impersonator, nobindingshere$0.HowDifferent, nobindingshere$0.PrivatePerson]> & { cancel(): void } { +export function LikeThisOne(): Promise<[nobindingshere$0.Person, nobindingshere$0.HowDifferent, nobindingshere$0.PrivatePerson]> & { cancel(): void } { let $resultPromise = $Call.ByID(2590614085) as any; let $typingPromise = $resultPromise.then(($result: any) => { $result[0] = $$createType0($result[0]); $result[1] = $$createType1($result[1]); $result[2] = $$createType2($result[2]); - $result[3] = $$createType3($result[3]); return $result; }) as any; $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); @@ -40,6 +39,5 @@ export function LikeThisOtherOne(): Promise & { cancel(): void } { // Private type creation functions const $$createType0 = nobindingshere$0.Person.createFrom; -const $$createType1 = nobindingshere$0.Impersonator.createFrom; -const $$createType2 = nobindingshere$0.HowDifferent.createFrom($Create.Any); -const $$createType3 = nobindingshere$0.PrivatePerson.createFrom; +const $$createType1 = nobindingshere$0.HowDifferent.createFrom($Create.Any); +const $$createType2 = nobindingshere$0.PrivatePerson.createFrom; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/greetservice.ts index 07b718c9979..9dec152c9b6 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/greetservice.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/greetservice.ts @@ -12,7 +12,7 @@ import {Call as $Call, Create as $Create} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Greet does XYZ diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/internal.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/internal.ts new file mode 100644 index 00000000000..474248f2e36 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/internal.ts @@ -0,0 +1,43 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Create as $Create} from "/wails/runtime.js"; + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import * as services$0 from "./services/models.js"; + +export class Person { + "Name": string; + "Address": services$0.Address | null; + + /** Creates a new Person instance. */ + constructor($$source: Partial = {}) { + if (!("Name" in $$source)) { + this["Name"] = ""; + } + if (!("Address" in $$source)) { + this["Address"] = null; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + */ + static createFrom($$source: any = {}): Person { + const $$createField1_0 = $$createType1; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Address" in $$parsedSource) { + $$parsedSource["Address"] = $$createField1_0($$parsedSource["Address"]); + } + return new Person($$parsedSource as Partial); + } +} + +// Private type creation functions +const $$createType0 = services$0.Address.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/models.ts index 474248f2e36..af848881144 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/models.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/models.ts @@ -1,43 +1,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import {Create as $Create} from "/wails/runtime.js"; - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as services$0 from "./services/models.js"; - -export class Person { - "Name": string; - "Address": services$0.Address | null; - - /** Creates a new Person instance. */ - constructor($$source: Partial = {}) { - if (!("Name" in $$source)) { - this["Name"] = ""; - } - if (!("Address" in $$source)) { - this["Address"] = null; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new Person instance from a string or object. - */ - static createFrom($$source: any = {}): Person { - const $$createField1_0 = $$createType1; - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - if ("Address" in $$parsedSource) { - $$parsedSource["Address"] = $$createField1_0($$parsedSource["Address"]); - } - return new Person($$parsedSource as Partial); - } -} - -// Private type creation functions -const $$createType0 = services$0.Address.createFrom; -const $$createType1 = $Create.Nullable($$createType0); +export { + Person +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/internal.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/internal.ts new file mode 100644 index 00000000000..eb9c1b6bf51 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/internal.ts @@ -0,0 +1,35 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Create as $Create} from "/wails/runtime.js"; + +export class Address { + "Street": string; + "State": string; + "Country": string; + + /** Creates a new Address instance. */ + constructor($$source: Partial
= {}) { + if (!("Street" in $$source)) { + this["Street"] = ""; + } + if (!("State" in $$source)) { + this["State"] = ""; + } + if (!("Country" in $$source)) { + this["Country"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Address instance from a string or object. + */ + static createFrom($$source: any = {}): Address { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new Address($$parsedSource as Partial
); + } +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/models.ts index eb9c1b6bf51..82637788023 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/models.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/models.ts @@ -1,35 +1,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import {Create as $Create} from "/wails/runtime.js"; - -export class Address { - "Street": string; - "State": string; - "Country": string; - - /** Creates a new Address instance. */ - constructor($$source: Partial
= {}) { - if (!("Street" in $$source)) { - this["Street"] = ""; - } - if (!("State" in $$source)) { - this["State"] = ""; - } - if (!("Country" in $$source)) { - this["Country"] = ""; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new Address instance from a string or object. - */ - static createFrom($$source: any = {}): Address { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - return new Address($$parsedSource as Partial
); - } -} +export { + Address +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/otherservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/otherservice.ts index 7b37ce5d6f1..f9f764dcb6a 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/otherservice.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/otherservice.ts @@ -13,7 +13,7 @@ import {Call as $Call, Create as $Create} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Yay does this and that diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/greetservice.ts index f6e13812f35..468b0af9c77 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/greetservice.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/greetservice.ts @@ -12,7 +12,7 @@ import {Call as $Call, Create as $Create} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; export function ArrayInt($in: number[]): Promise & { cancel(): void } { let $resultPromise = $Call.ByID(3862002418, $in) as any; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/internal.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/internal.ts new file mode 100644 index 00000000000..3dd1908e176 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/internal.ts @@ -0,0 +1,43 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Create as $Create} from "/wails/runtime.js"; + +export class Person { + "Name": string; + "Parent": Person | null; + "Details": {"Age": number, "Address": {"Street": string}}; + + /** Creates a new Person instance. */ + constructor($$source: Partial = {}) { + if (!("Name" in $$source)) { + this["Name"] = ""; + } + if (!("Parent" in $$source)) { + this["Parent"] = null; + } + if (!("Details" in $$source)) { + this["Details"] = {"Age": 0, "Address": {"Street": ""}}; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + */ + static createFrom($$source: any = {}): Person { + const $$createField1_0 = $$createType1; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Parent" in $$parsedSource) { + $$parsedSource["Parent"] = $$createField1_0($$parsedSource["Parent"]); + } + return new Person($$parsedSource as Partial); + } +} + +// Private type creation functions +const $$createType0 = Person.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/models.ts index 3dd1908e176..af848881144 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/models.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/models.ts @@ -1,43 +1,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import {Create as $Create} from "/wails/runtime.js"; - -export class Person { - "Name": string; - "Parent": Person | null; - "Details": {"Age": number, "Address": {"Street": string}}; - - /** Creates a new Person instance. */ - constructor($$source: Partial = {}) { - if (!("Name" in $$source)) { - this["Name"] = ""; - } - if (!("Parent" in $$source)) { - this["Parent"] = null; - } - if (!("Details" in $$source)) { - this["Details"] = {"Age": 0, "Address": {"Street": ""}}; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new Person instance from a string or object. - */ - static createFrom($$source: any = {}): Person { - const $$createField1_0 = $$createType1; - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - if ("Parent" in $$parsedSource) { - $$parsedSource["Parent"] = $$createField1_0($$parsedSource["Parent"]); - } - return new Person($$parsedSource as Partial); - } -} - -// Private type creation functions -const $$createType0 = Person.createFrom; -const $$createType1 = $Create.Nullable($$createType0); +export { + Person +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/greetservice.ts index f6e13812f35..468b0af9c77 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/greetservice.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/greetservice.ts @@ -12,7 +12,7 @@ import {Call as $Call, Create as $Create} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; export function ArrayInt($in: number[]): Promise & { cancel(): void } { let $resultPromise = $Call.ByID(3862002418, $in) as any; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/internal.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/internal.ts new file mode 100644 index 00000000000..3dd1908e176 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/internal.ts @@ -0,0 +1,43 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Create as $Create} from "/wails/runtime.js"; + +export class Person { + "Name": string; + "Parent": Person | null; + "Details": {"Age": number, "Address": {"Street": string}}; + + /** Creates a new Person instance. */ + constructor($$source: Partial = {}) { + if (!("Name" in $$source)) { + this["Name"] = ""; + } + if (!("Parent" in $$source)) { + this["Parent"] = null; + } + if (!("Details" in $$source)) { + this["Details"] = {"Age": 0, "Address": {"Street": ""}}; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + */ + static createFrom($$source: any = {}): Person { + const $$createField1_0 = $$createType1; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Parent" in $$parsedSource) { + $$parsedSource["Parent"] = $$createField1_0($$parsedSource["Parent"]); + } + return new Person($$parsedSource as Partial); + } +} + +// Private type creation functions +const $$createType0 = Person.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/models.ts index 3dd1908e176..af848881144 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/models.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/models.ts @@ -1,43 +1,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import {Create as $Create} from "/wails/runtime.js"; - -export class Person { - "Name": string; - "Parent": Person | null; - "Details": {"Age": number, "Address": {"Street": string}}; - - /** Creates a new Person instance. */ - constructor($$source: Partial = {}) { - if (!("Name" in $$source)) { - this["Name"] = ""; - } - if (!("Parent" in $$source)) { - this["Parent"] = null; - } - if (!("Details" in $$source)) { - this["Details"] = {"Age": 0, "Address": {"Street": ""}}; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new Person instance from a string or object. - */ - static createFrom($$source: any = {}): Person { - const $$createField1_0 = $$createType1; - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - if ("Parent" in $$parsedSource) { - $$parsedSource["Parent"] = $$createField1_0($$parsedSource["Parent"]); - } - return new Person($$parsedSource as Partial); - } -} - -// Private type creation functions -const $$createType0 = Person.createFrom; -const $$createType1 = $Create.Nullable($$createType0); +export { + Person +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/greetservice.ts index 07b718c9979..9dec152c9b6 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/greetservice.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/greetservice.ts @@ -12,7 +12,7 @@ import {Call as $Call, Create as $Create} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Greet does XYZ diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/internal.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/internal.ts new file mode 100644 index 00000000000..4442874d2a9 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/internal.ts @@ -0,0 +1,47 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Create as $Create} from "/wails/runtime.js"; + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import * as services$0 from "./services/models.js"; + +/** + * Person is a person! + * They have a name and an address + */ +export class Person { + "Name": string; + "Address": services$0.Address | null; + + /** Creates a new Person instance. */ + constructor($$source: Partial = {}) { + if (!("Name" in $$source)) { + this["Name"] = ""; + } + if (!("Address" in $$source)) { + this["Address"] = null; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + */ + static createFrom($$source: any = {}): Person { + const $$createField1_0 = $$createType1; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Address" in $$parsedSource) { + $$parsedSource["Address"] = $$createField1_0($$parsedSource["Address"]); + } + return new Person($$parsedSource as Partial); + } +} + +// Private type creation functions +const $$createType0 = services$0.Address.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/models.ts index 4442874d2a9..af848881144 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/models.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/models.ts @@ -1,47 +1,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import {Create as $Create} from "/wails/runtime.js"; - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as services$0 from "./services/models.js"; - -/** - * Person is a person! - * They have a name and an address - */ -export class Person { - "Name": string; - "Address": services$0.Address | null; - - /** Creates a new Person instance. */ - constructor($$source: Partial = {}) { - if (!("Name" in $$source)) { - this["Name"] = ""; - } - if (!("Address" in $$source)) { - this["Address"] = null; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new Person instance from a string or object. - */ - static createFrom($$source: any = {}): Person { - const $$createField1_0 = $$createType1; - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - if ("Address" in $$parsedSource) { - $$parsedSource["Address"] = $$createField1_0($$parsedSource["Address"]); - } - return new Person($$parsedSource as Partial); - } -} - -// Private type creation functions -const $$createType0 = services$0.Address.createFrom; -const $$createType1 = $Create.Nullable($$createType0); +export { + Person +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/internal.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/internal.ts new file mode 100644 index 00000000000..eb9c1b6bf51 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/internal.ts @@ -0,0 +1,35 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Create as $Create} from "/wails/runtime.js"; + +export class Address { + "Street": string; + "State": string; + "Country": string; + + /** Creates a new Address instance. */ + constructor($$source: Partial
= {}) { + if (!("Street" in $$source)) { + this["Street"] = ""; + } + if (!("State" in $$source)) { + this["State"] = ""; + } + if (!("Country" in $$source)) { + this["Country"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Address instance from a string or object. + */ + static createFrom($$source: any = {}): Address { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new Address($$parsedSource as Partial
); + } +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/models.ts index eb9c1b6bf51..82637788023 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/models.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/models.ts @@ -1,35 +1,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import {Create as $Create} from "/wails/runtime.js"; - -export class Address { - "Street": string; - "State": string; - "Country": string; - - /** Creates a new Address instance. */ - constructor($$source: Partial
= {}) { - if (!("Street" in $$source)) { - this["Street"] = ""; - } - if (!("State" in $$source)) { - this["State"] = ""; - } - if (!("Country" in $$source)) { - this["Country"] = ""; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new Address instance from a string or object. - */ - static createFrom($$source: any = {}): Address { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - return new Address($$parsedSource as Partial
); - } -} +export { + Address +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/otherservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/otherservice.ts index 04f8b68ea4e..bd028e567d3 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/otherservice.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/otherservice.ts @@ -13,7 +13,7 @@ import {Call as $Call, Create as $Create} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Yay does this and that diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/greetservice.ts index b390b521bf4..d379edae9a5 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/greetservice.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/greetservice.ts @@ -12,10 +12,10 @@ import {Call as $Call, Create as $Create} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** - * Get someone + * Get someone. */ export function Get(aliasValue: $models.Alias): Promise<$models.Person> & { cancel(): void } { let $resultPromise = $Call.ByName("main.GreetService.Get", aliasValue) as any; @@ -27,7 +27,19 @@ export function Get(aliasValue: $models.Alias): Promise<$models.Person> & { canc } /** - * Get someone quite different + * Apparently, aliases are all the rage right now. + */ +export function GetButAliased(p: $models.AliasedPerson): Promise<$models.StrangelyAliasedPerson> & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.GetButAliased", p) as any; + let $typingPromise = $resultPromise.then(($result: any) => { + return $$createType0($result); + }) as any; + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +/** + * Get someone quite different. */ export function GetButDifferent(): Promise<$models.GenericPerson> & { cancel(): void } { let $resultPromise = $Call.ByName("main.GreetService.GetButDifferent") as any; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/internal.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/internal.ts new file mode 100644 index 00000000000..2501e921e05 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/internal.ts @@ -0,0 +1,157 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Create as $Create} from "/wails/runtime.js"; + +/** + * A nice type Alias. + */ +export type Alias = number; + +/** + * A struct alias. + * This should be rendered as a typedef or interface in every mode. + */ +export interface AliasStruct { + /** + * A field with a comment. + */ + "Foo": number[]; + + /** + * Definitely not Foo. + */ + "Bar"?: string; + "Baz"?: string; + + /** + * A nested alias struct. + */ + "Other": OtherAliasStruct; +} + +/** + * An empty struct alias. + */ +export interface EmptyAliasStruct { +} + +/** + * An empty struct. + */ +export class EmptyStruct { + + /** Creates a new EmptyStruct instance. */ + constructor($$source: Partial = {}) { + + Object.assign(this, $$source); + } + + /** + * Creates a new EmptyStruct instance from a string or object. + */ + static createFrom($$source: any = {}): EmptyStruct { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new EmptyStruct($$parsedSource as Partial); + } +} + +/** + * A generic struct containing an alias. + */ +export class GenericPerson { + "Name": T | null; + "AliasedField": Alias; + + /** Creates a new GenericPerson instance. */ + constructor($$source: Partial> = {}) { + if (!("Name" in $$source)) { + this["Name"] = null; + } + if (!("AliasedField" in $$source)) { + this["AliasedField"] = 0; + } + + Object.assign(this, $$source); + } + + /** + * Given creation functions for each type parameter, + * returns a creation function for a concrete instance + * of the generic class GenericPerson. + */ + static createFrom($$createParamT: (source: any) => T): ($$source?: any) => GenericPerson { + const $$createField0_0 = $$createParamT; + return ($$source: any = {}) => { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Name" in $$parsedSource) { + $$parsedSource["Name"] = $$createField0_0($$parsedSource["Name"]); + } + return new GenericPerson($$parsedSource as Partial>); + }; + } +} + +/** + * Another struct alias. + */ +export interface OtherAliasStruct { + "NoMoreIdeas": number[]; +} + +/** + * A non-generic struct containing an alias. + */ +export class Person { + /** + * The Person's name. + */ + "Name": string; + + /** + * A random alias field. + */ + "AliasedField": Alias; + + /** Creates a new Person instance. */ + constructor($$source: Partial = {}) { + if (!("Name" in $$source)) { + this["Name"] = ""; + } + if (!("AliasedField" in $$source)) { + this["AliasedField"] = 0; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + */ + static createFrom($$source: any = {}): Person { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new Person($$parsedSource as Partial); + } +} + +/** + * A class alias. + */ +export const AliasedPerson = Person; + +/** + * A class alias. + */ +export type AliasedPerson = Person; + +/** + * Another class alias, but ordered after its aliased class. + */ +export const StrangelyAliasedPerson = Person; + +/** + * Another class alias, but ordered after its aliased class. + */ +export type StrangelyAliasedPerson = Person; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/models.ts index cd813c39b9d..48ca89425e6 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/models.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/models.ts @@ -1,137 +1,17 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import {Create as $Create} from "/wails/runtime.js"; - -/** - * A nice type Alias - */ -export type Alias = number; - -/** - * A struct alias. - * This should be rendered as a typedef or interface in every mode. - */ -export interface AliasStruct { - /** - * A field with a comment. - */ - "Foo": number[]; - - /** - * Definitely not Foo. - */ - "Bar"?: string; - "Baz"?: string; - - /** - * A nested alias struct. - */ - "Other": OtherAliasStruct; -} - -/** - * An empty struct alias. - */ -export interface EmptyAliasStruct { -} - -/** - * An empty struct. - */ -export class EmptyStruct { - - /** Creates a new EmptyStruct instance. */ - constructor($$source: Partial = {}) { - - Object.assign(this, $$source); - } - - /** - * Creates a new EmptyStruct instance from a string or object. - */ - static createFrom($$source: any = {}): EmptyStruct { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - return new EmptyStruct($$parsedSource as Partial); - } -} - -/** - * A generic struct containing an alias - */ -export class GenericPerson { - "Name": T | null; - "AliasedField": Alias; - - /** Creates a new GenericPerson instance. */ - constructor($$source: Partial> = {}) { - if (!("Name" in $$source)) { - this["Name"] = null; - } - if (!("AliasedField" in $$source)) { - this["AliasedField"] = 0; - } - - Object.assign(this, $$source); - } - - /** - * Given creation functions for each type parameter, - * returns a creation function for a concrete instance - * of the generic class GenericPerson. - */ - static createFrom($$createParamT: (source: any) => T): ($$source?: any) => GenericPerson { - const $$createField0_0 = $$createParamT; - return ($$source: any = {}) => { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - if ("Name" in $$parsedSource) { - $$parsedSource["Name"] = $$createField0_0($$parsedSource["Name"]); - } - return new GenericPerson($$parsedSource as Partial>); - }; - } -} - -/** - * Another struct alias. - */ -export interface OtherAliasStruct { - "NoMoreIdeas": number[]; -} - -/** - * A non-generic struct containing an alias. - */ -export class Person { - /** - * The Person's name. - */ - "Name": string; - - /** - * A random alias field. - */ - "AliasedField": Alias; - - /** Creates a new Person instance. */ - constructor($$source: Partial = {}) { - if (!("Name" in $$source)) { - this["Name"] = ""; - } - if (!("AliasedField" in $$source)) { - this["AliasedField"] = 0; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new Person instance from a string or object. - */ - static createFrom($$source: any = {}): Person { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - return new Person($$parsedSource as Partial); - } -} +export { + AliasedPerson, + EmptyStruct, + GenericPerson, + Person, + StrangelyAliasedPerson +} from "./internal.js"; + +export type { + Alias, + AliasStruct, + EmptyAliasStruct, + OtherAliasStruct +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/greetservice.ts index 004971239b9..eb630a91d8d 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/greetservice.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/greetservice.ts @@ -12,7 +12,7 @@ import {Call as $Call, Create as $Create} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Greet does XYZ diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/internal.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/internal.ts index a0b9ce4c2cc..026a31d2e46 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/internal.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/internal.ts @@ -5,6 +5,195 @@ // @ts-ignore: Unused imports import {Create as $Create} from "/wails/runtime.js"; +export class Embedded1 { + /** + * Friends should be shadowed in Person by a field of lesser depth + */ + "Friends": number; + + /** + * Vanish should be omitted from Person because there is another field with same depth and no tag + */ + "Vanish": number; + + /** + * StillThere should be shadowed in Person by other field with same depth and a json tag + */ + "StillThere": string; + + /** + * NamingThingsIsHard is a law of programming + */ + "NamingThingsIsHard": `${boolean}`; + + /** Creates a new Embedded1 instance. */ + constructor($$source: Partial = {}) { + if (!("Friends" in $$source)) { + this["Friends"] = 0; + } + if (!("Vanish" in $$source)) { + this["Vanish"] = 0; + } + if (!("StillThere" in $$source)) { + this["StillThere"] = ""; + } + if (!("NamingThingsIsHard" in $$source)) { + this["NamingThingsIsHard"] = "false"; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Embedded1 instance from a string or object. + */ + static createFrom($$source: any = {}): Embedded1 { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new Embedded1($$parsedSource as Partial); + } +} + +export type Embedded3 = string; + +/** + * Person represents a person + */ +export class Person { + /** + * Titles is optional in JSON + */ + "Titles"?: Title[]; + + /** + * Names has a + * multiline comment + */ + "Names": string[]; + + /** + * Partner has a custom and complex JSON key + */ + "Partner": Person | null; + "Friends": (Person | null)[]; + + /** + * NamingThingsIsHard is a law of programming + */ + "NamingThingsIsHard": `${boolean}`; + + /** + * StillThereButRenamed should shadow in Person the other field with same depth and no json tag + */ + "StillThere": Embedded3 | null; + + /** + * StrangeNumber maps to "-" + */ + "-": number; + + /** + * Embedded3 should appear with key "Embedded3" + */ + "Embedded3": Embedded3; + + /** + * StrangerNumber is serialized as a string + */ + "StrangerNumber": `${number}`; + + /** + * StrangestString is optional and serialized as a JSON string + */ + "StrangestString"?: `"${string}"`; + + /** + * StringStrangest is serialized as a JSON string and optional + */ + "StringStrangest"?: `"${string}"`; + + /** + * embedded4 should be optional and appear with key "emb4" + */ + "emb4"?: embedded4; + + /** Creates a new Person instance. */ + constructor($$source: Partial = {}) { + if (!("Names" in $$source)) { + this["Names"] = []; + } + if (!("Partner" in $$source)) { + this["Partner"] = null; + } + if (!("Friends" in $$source)) { + this["Friends"] = []; + } + if (!("NamingThingsIsHard" in $$source)) { + this["NamingThingsIsHard"] = "false"; + } + if (!("StillThere" in $$source)) { + this["StillThere"] = null; + } + if (!("-" in $$source)) { + this["-"] = 0; + } + if (!("Embedded3" in $$source)) { + this["Embedded3"] = ("" as Embedded3); + } + if (!("StrangerNumber" in $$source)) { + this["StrangerNumber"] = "0"; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + */ + static createFrom($$source: any = {}): Person { + const $$createField0_0 = $$createType0; + const $$createField1_0 = $$createType1; + const $$createField2_0 = $$createType3; + const $$createField3_0 = $$createType4; + const $$createField11_0 = $$createType5; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Titles" in $$parsedSource) { + $$parsedSource["Titles"] = $$createField0_0($$parsedSource["Titles"]); + } + if ("Names" in $$parsedSource) { + $$parsedSource["Names"] = $$createField1_0($$parsedSource["Names"]); + } + if ("Partner" in $$parsedSource) { + $$parsedSource["Partner"] = $$createField2_0($$parsedSource["Partner"]); + } + if ("Friends" in $$parsedSource) { + $$parsedSource["Friends"] = $$createField3_0($$parsedSource["Friends"]); + } + if ("emb4" in $$parsedSource) { + $$parsedSource["emb4"] = $$createField11_0($$parsedSource["emb4"]); + } + return new Person($$parsedSource as Partial); + } +} + +/** + * Title is a title + */ +export enum Title { + /** + * The Go zero value for the underlying type of the enum. + */ + $zero = "", + + /** + * Mister is a title + */ + Mister = "Mr", + Miss = "Miss", + Ms = "Ms", + Mrs = "Mrs", + Dr = "Dr", +}; + export class embedded4 { /** * NamingThingsIsHard is a law of programming @@ -38,3 +227,11 @@ export class embedded4 { return new embedded4($$parsedSource as Partial); } } + +// Private type creation functions +const $$createType0 = $Create.Array($Create.Any); +const $$createType1 = $Create.Array($Create.Any); +const $$createType2 = Person.createFrom; +const $$createType3 = $Create.Nullable($$createType2); +const $$createType4 = $Create.Array($$createType3); +const $$createType5 = embedded4.createFrom; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/models.ts index 11fdefc27e6..56a4bb6596c 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/models.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/models.ts @@ -1,207 +1,12 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import {Create as $Create} from "/wails/runtime.js"; - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as $internal from "./internal.js"; - -export class Embedded1 { - /** - * Friends should be shadowed in Person by a field of lesser depth - */ - "Friends": number; - - /** - * Vanish should be omitted from Person because there is another field with same depth and no tag - */ - "Vanish": number; - - /** - * StillThere should be shadowed in Person by other field with same depth and a json tag - */ - "StillThere": string; - - /** - * NamingThingsIsHard is a law of programming - */ - "NamingThingsIsHard": `${boolean}`; - - /** Creates a new Embedded1 instance. */ - constructor($$source: Partial = {}) { - if (!("Friends" in $$source)) { - this["Friends"] = 0; - } - if (!("Vanish" in $$source)) { - this["Vanish"] = 0; - } - if (!("StillThere" in $$source)) { - this["StillThere"] = ""; - } - if (!("NamingThingsIsHard" in $$source)) { - this["NamingThingsIsHard"] = "false"; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new Embedded1 instance from a string or object. - */ - static createFrom($$source: any = {}): Embedded1 { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - return new Embedded1($$parsedSource as Partial); - } -} - -export type Embedded3 = string; - -/** - * Person represents a person - */ -export class Person { - /** - * Titles is optional in JSON - */ - "Titles"?: Title[]; - - /** - * Names has a - * multiline comment - */ - "Names": string[]; - - /** - * Partner has a custom and complex JSON key - */ - "Partner": Person | null; - "Friends": (Person | null)[]; - - /** - * NamingThingsIsHard is a law of programming - */ - "NamingThingsIsHard": `${boolean}`; - - /** - * StillThereButRenamed should shadow in Person the other field with same depth and no json tag - */ - "StillThere": Embedded3 | null; - - /** - * StrangeNumber maps to "-" - */ - "-": number; - - /** - * Embedded3 should appear with key "Embedded3" - */ - "Embedded3": Embedded3; - - /** - * StrangerNumber is serialized as a string - */ - "StrangerNumber": `${number}`; - - /** - * StrangestString is optional and serialized as a JSON string - */ - "StrangestString"?: `"${string}"`; - - /** - * StringStrangest is serialized as a JSON string and optional - */ - "StringStrangest"?: `"${string}"`; - - /** - * embedded4 should be optional and appear with key "emb4" - */ - "emb4"?: $internal.embedded4; - - /** Creates a new Person instance. */ - constructor($$source: Partial = {}) { - if (!("Names" in $$source)) { - this["Names"] = []; - } - if (!("Partner" in $$source)) { - this["Partner"] = null; - } - if (!("Friends" in $$source)) { - this["Friends"] = []; - } - if (!("NamingThingsIsHard" in $$source)) { - this["NamingThingsIsHard"] = "false"; - } - if (!("StillThere" in $$source)) { - this["StillThere"] = null; - } - if (!("-" in $$source)) { - this["-"] = 0; - } - if (!("Embedded3" in $$source)) { - this["Embedded3"] = ("" as Embedded3); - } - if (!("StrangerNumber" in $$source)) { - this["StrangerNumber"] = "0"; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new Person instance from a string or object. - */ - static createFrom($$source: any = {}): Person { - const $$createField0_0 = $$createType0; - const $$createField1_0 = $$createType1; - const $$createField2_0 = $$createType3; - const $$createField3_0 = $$createType4; - const $$createField11_0 = $$createType5; - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - if ("Titles" in $$parsedSource) { - $$parsedSource["Titles"] = $$createField0_0($$parsedSource["Titles"]); - } - if ("Names" in $$parsedSource) { - $$parsedSource["Names"] = $$createField1_0($$parsedSource["Names"]); - } - if ("Partner" in $$parsedSource) { - $$parsedSource["Partner"] = $$createField2_0($$parsedSource["Partner"]); - } - if ("Friends" in $$parsedSource) { - $$parsedSource["Friends"] = $$createField3_0($$parsedSource["Friends"]); - } - if ("emb4" in $$parsedSource) { - $$parsedSource["emb4"] = $$createField11_0($$parsedSource["emb4"]); - } - return new Person($$parsedSource as Partial); - } -} - -/** - * Title is a title - */ -export enum Title { - /** - * The Go zero value for the underlying type of the enum. - */ - $zero = "", - - /** - * Mister is a title - */ - Mister = "Mr", - Miss = "Miss", - Ms = "Ms", - Mrs = "Mrs", - Dr = "Dr", -}; - -// Private type creation functions -const $$createType0 = $Create.Array($Create.Any); -const $$createType1 = $Create.Array($Create.Any); -const $$createType2 = Person.createFrom; -const $$createType3 = $Create.Nullable($$createType2); -const $$createType4 = $Create.Array($$createType3); -const $$createType5 = $internal.embedded4.createFrom; +export { + Embedded1, + Person, + Title +} from "./internal.js"; + +export type { + Embedded3 +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/greetservice.ts index 45311c10ca8..2633d1f2dd1 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/greetservice.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/greetservice.ts @@ -12,7 +12,7 @@ import {Call as $Call, Create as $Create} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Greet does XYZ diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/internal.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/internal.ts new file mode 100644 index 00000000000..66dc1409230 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/internal.ts @@ -0,0 +1,30 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Create as $Create} from "/wails/runtime.js"; + +/** + * Person represents a person + */ +export class Person { + "Name": string; + + /** Creates a new Person instance. */ + constructor($$source: Partial = {}) { + if (!("Name" in $$source)) { + this["Name"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + */ + static createFrom($$source: any = {}): Person { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new Person($$parsedSource as Partial); + } +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/models.ts index 66dc1409230..af848881144 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/models.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/models.ts @@ -1,30 +1,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import {Create as $Create} from "/wails/runtime.js"; - -/** - * Person represents a person - */ -export class Person { - "Name": string; - - /** Creates a new Person instance. */ - constructor($$source: Partial = {}) { - if (!("Name" in $$source)) { - this["Name"] = ""; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new Person instance from a string or object. - */ - static createFrom($$source: any = {}): Person { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - return new Person($$parsedSource as Partial); - } -} +export { + Person +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/greetservice.ts new file mode 100644 index 00000000000..4550785d8be --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/greetservice.ts @@ -0,0 +1,33 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import * as $models from "./internal.js"; + +/** + * Make a cycle. + */ +export function MakeCycles(): Promise<[$models.StructA, $models.StructC]> & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.MakeCycles") as any; + let $typingPromise = $resultPromise.then(($result: any) => { + $result[0] = $$createType0($result[0]); + $result[1] = $$createType1($result[1]); + return $result; + }) as any; + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +// Private type creation functions +const $$createType0 = $models.StructA.createFrom; +const $$createType1 = $models.StructC.createFrom; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/index.ts similarity index 100% rename from v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/index.ts rename to v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/index.ts diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/internal.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/internal.ts new file mode 100644 index 00000000000..a79d42f3294 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/internal.ts @@ -0,0 +1,131 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Create as $Create} from "/wails/runtime.js"; + +export class StructA { + "B": structB | null; + + /** Creates a new StructA instance. */ + constructor($$source: Partial = {}) { + if (!("B" in $$source)) { + this["B"] = null; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new StructA instance from a string or object. + */ + static createFrom($$source: any = {}): StructA { + const $$createField0_0 = $$createType1; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("B" in $$parsedSource) { + $$parsedSource["B"] = $$createField0_0($$parsedSource["B"]); + } + return new StructA($$parsedSource as Partial); + } +} + +export class StructC { + "D": structD; + + /** Creates a new StructC instance. */ + constructor($$source: Partial = {}) { + if (!("D" in $$source)) { + this["D"] = (new structD()); + } + + Object.assign(this, $$source); + } + + /** + * Creates a new StructC instance from a string or object. + */ + static createFrom($$source: any = {}): StructC { + const $$createField0_0 = $$createType2; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("D" in $$parsedSource) { + $$parsedSource["D"] = $$createField0_0($$parsedSource["D"]); + } + return new StructC($$parsedSource as Partial); + } +} + +export class StructE { + + /** Creates a new StructE instance. */ + constructor($$source: Partial = {}) { + + Object.assign(this, $$source); + } + + /** + * Creates a new StructE instance from a string or object. + */ + static createFrom($$source: any = {}): StructE { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new StructE($$parsedSource as Partial); + } +} + +export class structB { + "A": StructA | null; + + /** Creates a new structB instance. */ + constructor($$source: Partial = {}) { + if (!("A" in $$source)) { + this["A"] = null; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new structB instance from a string or object. + */ + static createFrom($$source: any = {}): structB { + const $$createField0_0 = $$createType4; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("A" in $$parsedSource) { + $$parsedSource["A"] = $$createField0_0($$parsedSource["A"]); + } + return new structB($$parsedSource as Partial); + } +} + +export class structD { + "E": StructE; + + /** Creates a new structD instance. */ + constructor($$source: Partial = {}) { + if (!("E" in $$source)) { + this["E"] = (new StructE()); + } + + Object.assign(this, $$source); + } + + /** + * Creates a new structD instance from a string or object. + */ + static createFrom($$source: any = {}): structD { + const $$createField0_0 = $$createType5; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("E" in $$parsedSource) { + $$parsedSource["E"] = $$createField0_0($$parsedSource["E"]); + } + return new structD($$parsedSource as Partial); + } +} + +// Private type creation functions +const $$createType0 = structB.createFrom; +const $$createType1 = $Create.Nullable($$createType0); +const $$createType2 = structD.createFrom; +const $$createType3 = StructA.createFrom; +const $$createType4 = $Create.Nullable($$createType3); +const $$createType5 = StructE.createFrom; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/models.ts new file mode 100644 index 00000000000..f6997135d06 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/models.ts @@ -0,0 +1,8 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +export { + StructA, + StructC, + StructE +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/greetservice.ts similarity index 98% rename from v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/greetservice.ts rename to v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/greetservice.ts index 3af14c1c5a6..db33f4ba0c4 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/greetservice.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/greetservice.ts @@ -12,7 +12,7 @@ import {Call as $Call, Create as $Create} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Make a cycle. diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/index.ts similarity index 100% rename from v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/index.ts rename to v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/index.ts diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/internal.ts similarity index 100% rename from v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/models.ts rename to v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/internal.ts diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/models.ts new file mode 100644 index 00000000000..e4c8045036d --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/models.ts @@ -0,0 +1,8 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +export type { + Alias, + Cyclic, + GenericCyclic +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/greetservice.ts index 3fdf09b81a2..1145378ddb0 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/greetservice.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/greetservice.ts @@ -12,7 +12,7 @@ import {Call as $Call, Create as $Create} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Greet does XYZ diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/internal.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/internal.ts new file mode 100644 index 00000000000..bc7cd496495 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/internal.ts @@ -0,0 +1,53 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Create as $Create} from "/wails/runtime.js"; + +/** + * Person represents a person + */ +export class Person { + "Title": Title; + "Name": string; + + /** Creates a new Person instance. */ + constructor($$source: Partial = {}) { + if (!("Title" in $$source)) { + this["Title"] = ("" as Title); + } + if (!("Name" in $$source)) { + this["Name"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + */ + static createFrom($$source: any = {}): Person { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new Person($$parsedSource as Partial); + } +} + +/** + * Title is a title + */ +export enum Title { + /** + * The Go zero value for the underlying type of the enum. + */ + $zero = "", + + /** + * Mister is a title + */ + Mister = "Mr", + Miss = "Miss", + Ms = "Ms", + Mrs = "Mrs", + Dr = "Dr", +}; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/models.ts index bc7cd496495..728210dfb52 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/models.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/models.ts @@ -1,53 +1,7 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import {Create as $Create} from "/wails/runtime.js"; - -/** - * Person represents a person - */ -export class Person { - "Title": Title; - "Name": string; - - /** Creates a new Person instance. */ - constructor($$source: Partial = {}) { - if (!("Title" in $$source)) { - this["Title"] = ("" as Title); - } - if (!("Name" in $$source)) { - this["Name"] = ""; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new Person instance from a string or object. - */ - static createFrom($$source: any = {}): Person { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - return new Person($$parsedSource as Partial); - } -} - -/** - * Title is a title - */ -export enum Title { - /** - * The Go zero value for the underlying type of the enum. - */ - $zero = "", - - /** - * Mister is a title - */ - Mister = "Mr", - Miss = "Miss", - Ms = "Ms", - Mrs = "Mrs", - Dr = "Dr", -}; +export { + Person, + Title +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/internal.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/internal.ts new file mode 100644 index 00000000000..335543dbbb8 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/internal.ts @@ -0,0 +1,22 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Create as $Create} from "/wails/runtime.js"; + +export enum Title { + /** + * The Go zero value for the underlying type of the enum. + */ + $zero = "", + + /** + * Mister is a title + */ + Mister = "Mr", + Miss = "Miss", + Ms = "Ms", + Mrs = "Mrs", + Dr = "Dr", +}; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/models.ts index 335543dbbb8..e8981fc5e89 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/models.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/models.ts @@ -1,22 +1,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import {Create as $Create} from "/wails/runtime.js"; - -export enum Title { - /** - * The Go zero value for the underlying type of the enum. - */ - $zero = "", - - /** - * Mister is a title - */ - Mister = "Mr", - Miss = "Miss", - Ms = "Ms", - Mrs = "Mrs", - Dr = "Dr", -}; +export { + Title +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/greetservice.ts index 49c20faa362..d7dea4fbabb 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/greetservice.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/greetservice.ts @@ -12,7 +12,7 @@ import {Call as $Call, Create as $Create} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Greet does XYZ diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/internal.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/internal.ts new file mode 100644 index 00000000000..02707e2caa9 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/internal.ts @@ -0,0 +1,46 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Create as $Create} from "/wails/runtime.js"; + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import * as services$0 from "./services/models.js"; + +/** + * Person is a person + */ +export class Person { + "Name": string; + "Address": services$0.Address | null; + + /** Creates a new Person instance. */ + constructor($$source: Partial = {}) { + if (!("Name" in $$source)) { + this["Name"] = ""; + } + if (!("Address" in $$source)) { + this["Address"] = null; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + */ + static createFrom($$source: any = {}): Person { + const $$createField1_0 = $$createType1; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Address" in $$parsedSource) { + $$parsedSource["Address"] = $$createField1_0($$parsedSource["Address"]); + } + return new Person($$parsedSource as Partial); + } +} + +// Private type creation functions +const $$createType0 = services$0.Address.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/models.ts index 02707e2caa9..af848881144 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/models.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/models.ts @@ -1,46 +1,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import {Create as $Create} from "/wails/runtime.js"; - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as services$0 from "./services/models.js"; - -/** - * Person is a person - */ -export class Person { - "Name": string; - "Address": services$0.Address | null; - - /** Creates a new Person instance. */ - constructor($$source: Partial = {}) { - if (!("Name" in $$source)) { - this["Name"] = ""; - } - if (!("Address" in $$source)) { - this["Address"] = null; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new Person instance from a string or object. - */ - static createFrom($$source: any = {}): Person { - const $$createField1_0 = $$createType1; - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - if ("Address" in $$parsedSource) { - $$parsedSource["Address"] = $$createField1_0($$parsedSource["Address"]); - } - return new Person($$parsedSource as Partial); - } -} - -// Private type creation functions -const $$createType0 = services$0.Address.createFrom; -const $$createType1 = $Create.Nullable($$createType0); +export { + Person +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/internal.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/internal.ts new file mode 100644 index 00000000000..eb9c1b6bf51 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/internal.ts @@ -0,0 +1,35 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Create as $Create} from "/wails/runtime.js"; + +export class Address { + "Street": string; + "State": string; + "Country": string; + + /** Creates a new Address instance. */ + constructor($$source: Partial
= {}) { + if (!("Street" in $$source)) { + this["Street"] = ""; + } + if (!("State" in $$source)) { + this["State"] = ""; + } + if (!("Country" in $$source)) { + this["Country"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Address instance from a string or object. + */ + static createFrom($$source: any = {}): Address { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new Address($$parsedSource as Partial
); + } +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/models.ts index eb9c1b6bf51..82637788023 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/models.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/models.ts @@ -1,35 +1,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import {Create as $Create} from "/wails/runtime.js"; - -export class Address { - "Street": string; - "State": string; - "Country": string; - - /** Creates a new Address instance. */ - constructor($$source: Partial
= {}) { - if (!("Street" in $$source)) { - this["Street"] = ""; - } - if (!("State" in $$source)) { - this["State"] = ""; - } - if (!("Country" in $$source)) { - this["Country"] = ""; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new Address instance from a string or object. - */ - static createFrom($$source: any = {}): Address { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - return new Address($$parsedSource as Partial
); - } -} +export { + Address +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/otherservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/otherservice.ts index 7423db695b6..9a75a5c05ab 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/otherservice.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/otherservice.ts @@ -13,7 +13,7 @@ import {Call as $Call, Create as $Create} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Yay does this and that diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/greetservice.ts index 49c20faa362..d7dea4fbabb 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/greetservice.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/greetservice.ts @@ -12,7 +12,7 @@ import {Call as $Call, Create as $Create} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Greet does XYZ diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/internal.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/internal.ts new file mode 100644 index 00000000000..c4a6d39ee62 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/internal.ts @@ -0,0 +1,43 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Create as $Create} from "/wails/runtime.js"; + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import * as other$0 from "./services/other/models.js"; + +export class Person { + "Name": string; + "Address": other$0.Address | null; + + /** Creates a new Person instance. */ + constructor($$source: Partial = {}) { + if (!("Name" in $$source)) { + this["Name"] = ""; + } + if (!("Address" in $$source)) { + this["Address"] = null; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + */ + static createFrom($$source: any = {}): Person { + const $$createField1_0 = $$createType1; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Address" in $$parsedSource) { + $$parsedSource["Address"] = $$createField1_0($$parsedSource["Address"]); + } + return new Person($$parsedSource as Partial); + } +} + +// Private type creation functions +const $$createType0 = other$0.Address.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/models.ts index c4a6d39ee62..af848881144 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/models.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/models.ts @@ -1,43 +1,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import {Create as $Create} from "/wails/runtime.js"; - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as other$0 from "./services/other/models.js"; - -export class Person { - "Name": string; - "Address": other$0.Address | null; - - /** Creates a new Person instance. */ - constructor($$source: Partial = {}) { - if (!("Name" in $$source)) { - this["Name"] = ""; - } - if (!("Address" in $$source)) { - this["Address"] = null; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new Person instance from a string or object. - */ - static createFrom($$source: any = {}): Person { - const $$createField1_0 = $$createType1; - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - if ("Address" in $$parsedSource) { - $$parsedSource["Address"] = $$createField1_0($$parsedSource["Address"]); - } - return new Person($$parsedSource as Partial); - } -} - -// Private type creation functions -const $$createType0 = other$0.Address.createFrom; -const $$createType1 = $Create.Nullable($$createType0); +export { + Person +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/internal.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/internal.ts new file mode 100644 index 00000000000..eb9c1b6bf51 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/internal.ts @@ -0,0 +1,35 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Create as $Create} from "/wails/runtime.js"; + +export class Address { + "Street": string; + "State": string; + "Country": string; + + /** Creates a new Address instance. */ + constructor($$source: Partial
= {}) { + if (!("Street" in $$source)) { + this["Street"] = ""; + } + if (!("State" in $$source)) { + this["State"] = ""; + } + if (!("Country" in $$source)) { + this["Country"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Address instance from a string or object. + */ + static createFrom($$source: any = {}): Address { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new Address($$parsedSource as Partial
); + } +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/models.ts index eb9c1b6bf51..82637788023 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/models.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/models.ts @@ -1,35 +1,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import {Create as $Create} from "/wails/runtime.js"; - -export class Address { - "Street": string; - "State": string; - "Country": string; - - /** Creates a new Address instance. */ - constructor($$source: Partial
= {}) { - if (!("Street" in $$source)) { - this["Street"] = ""; - } - if (!("State" in $$source)) { - this["State"] = ""; - } - if (!("Country" in $$source)) { - this["Country"] = ""; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new Address instance from a string or object. - */ - static createFrom($$source: any = {}): Address { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - return new Address($$parsedSource as Partial
); - } -} +export { + Address +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/otherservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/otherservice.ts index 27084cac3f6..d191a7d90cb 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/otherservice.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/otherservice.ts @@ -13,7 +13,7 @@ import {Call as $Call, Create as $Create} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Yay does this and that diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_internal/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_internal/greetservice.ts new file mode 100644 index 00000000000..e6dca1f048b --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_internal/greetservice.ts @@ -0,0 +1,19 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * Greet someone + */ +export function Greet(name: string): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Greet", name) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_internal/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_internal/index.ts new file mode 100644 index 00000000000..50e3f043598 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_internal/index.ts @@ -0,0 +1,7 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/internal.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/internal.ts index 13723a54993..da359b2834f 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/internal.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/internal.ts @@ -5,6 +5,103 @@ // @ts-ignore: Unused imports import {Create as $Create} from "/wails/runtime.js"; +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import * as other$0 from "./other/models.js"; + +/** + * HowDifferent is a curious kind of person + * that lets other people decide how they are different. + */ +export class HowDifferent { + /** + * They have a name as well. + */ + "Name": string; + + /** + * But they may have many differences. + */ + "Differences": { [_: string]: How | null }[]; + + /** Creates a new HowDifferent instance. */ + constructor($$source: Partial> = {}) { + if (!("Name" in $$source)) { + this["Name"] = ""; + } + if (!("Differences" in $$source)) { + this["Differences"] = []; + } + + Object.assign(this, $$source); + } + + /** + * Given creation functions for each type parameter, + * returns a creation function for a concrete instance + * of the generic class HowDifferent. + */ + static createFrom($$createParamHow: (source: any) => How): ($$source?: any) => HowDifferent { + const $$createField1_0 = $$createType1($$createParamHow); + return ($$source: any = {}) => { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Differences" in $$parsedSource) { + $$parsedSource["Differences"] = $$createField1_0($$parsedSource["Differences"]); + } + return new HowDifferent($$parsedSource as Partial>); + }; + } +} + +/** + * Impersonator gets their fields from other people. + */ +export const Impersonator = other$0.OtherPerson; + +/** + * Impersonator gets their fields from other people. + */ +export type Impersonator = other$0.OtherPerson; + +/** + * Person is not a number. + */ +export class Person { + /** + * They have a name. + */ + "Name": string; + + /** + * Exactly 4 sketchy friends. + */ + "Friends": Impersonator[]; + + /** Creates a new Person instance. */ + constructor($$source: Partial = {}) { + if (!("Name" in $$source)) { + this["Name"] = ""; + } + if (!("Friends" in $$source)) { + this["Friends"] = Array.from({ length: 4 }, () => (new Impersonator())); + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + */ + static createFrom($$source: any = {}): Person { + const $$createField1_0 = $$createType3; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Friends" in $$parsedSource) { + $$parsedSource["Friends"] = $$createField1_0($$parsedSource["Friends"]); + } + return new Person($$parsedSource as Partial); + } +} + export class personImpl { /** * Nickname conceals a person's identity. @@ -16,6 +113,11 @@ export class personImpl { */ "Name": string; + /** + * Exactly 4 sketchy friends. + */ + "Friends": Impersonator[]; + /** Creates a new personImpl instance. */ constructor($$source: Partial = {}) { if (!("Nickname" in $$source)) { @@ -24,6 +126,9 @@ export class personImpl { if (!("Name" in $$source)) { this["Name"] = ""; } + if (!("Friends" in $$source)) { + this["Friends"] = Array.from({ length: 4 }, () => (new Impersonator())); + } Object.assign(this, $$source); } @@ -32,7 +137,27 @@ export class personImpl { * Creates a new personImpl instance from a string or object. */ static createFrom($$source: any = {}): personImpl { + const $$createField2_0 = $$createType3; let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Friends" in $$parsedSource) { + $$parsedSource["Friends"] = $$createField2_0($$parsedSource["Friends"]); + } return new personImpl($$parsedSource as Partial); } } + +/** + * PrivatePerson gets their fields from hidden sources. + */ +export const PrivatePerson = personImpl; + +/** + * PrivatePerson gets their fields from hidden sources. + */ +export type PrivatePerson = personImpl; + +// Private type creation functions +const $$createType0 = ($$createParamHow) => $Create.Map($Create.Any, $$createParamHow); +const $$createType1 = ($$createParamHow) => $Create.Array($$createType0($$createParamHow)); +const $$createType2 = Impersonator.createFrom; +const $$createType3 = $Create.Array($$createType2); diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/models.ts index 7bb043fe601..8f1e3431141 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/models.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/models.ts @@ -1,109 +1,9 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import {Create as $Create} from "/wails/runtime.js"; - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as other$0 from "./other/models.js"; - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as $internal from "./internal.js"; - -/** - * HowDifferent is a curious kind of person - * that lets other people decide how they are different. - */ -export class HowDifferent { - /** - * They have a name as well. - */ - "Name": string; - - /** - * But they may have many differences. - */ - "Differences": { [_: string]: How | null }[]; - - /** Creates a new HowDifferent instance. */ - constructor($$source: Partial> = {}) { - if (!("Name" in $$source)) { - this["Name"] = ""; - } - if (!("Differences" in $$source)) { - this["Differences"] = []; - } - - Object.assign(this, $$source); - } - - /** - * Given creation functions for each type parameter, - * returns a creation function for a concrete instance - * of the generic class HowDifferent. - */ - static createFrom($$createParamHow: (source: any) => How): ($$source?: any) => HowDifferent { - const $$createField1_0 = $$createType1($$createParamHow); - return ($$source: any = {}) => { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - if ("Differences" in $$parsedSource) { - $$parsedSource["Differences"] = $$createField1_0($$parsedSource["Differences"]); - } - return new HowDifferent($$parsedSource as Partial>); - }; - } -} - -/** - * Impersonator gets their fields from other people. - */ -export const Impersonator = other$0.OtherPerson; - -/** - * Impersonator gets their fields from other people. - */ -export type Impersonator = other$0.OtherPerson; - -/** - * Person is not a number. - */ -export class Person { - /** - * They have a name. - */ - "Name": string; - - /** Creates a new Person instance. */ - constructor($$source: Partial = {}) { - if (!("Name" in $$source)) { - this["Name"] = ""; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new Person instance from a string or object. - */ - static createFrom($$source: any = {}): Person { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - return new Person($$parsedSource as Partial); - } -} - -/** - * PrivatePerson gets their fields from hidden sources. - */ -export const PrivatePerson = $internal.personImpl; - -/** - * PrivatePerson gets their fields from hidden sources. - */ -export type PrivatePerson = $internal.personImpl; - -// Private type creation functions -const $$createType0 = ($$createParamHow) => $Create.Map($Create.Any, $$createParamHow); -const $$createType1 = ($$createParamHow) => $Create.Array($$createType0($$createParamHow)); +export { + HowDifferent, + Impersonator, + Person, + PrivatePerson +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/internal.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/internal.ts new file mode 100644 index 00000000000..59343c53e2f --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/internal.ts @@ -0,0 +1,52 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Create as $Create} from "/wails/runtime.js"; + +/** + * OtherPerson is like a person, but different. + */ +export class OtherPerson { + /** + * They have a name as well. + */ + "Name": string; + + /** + * But they may have many differences. + */ + "Differences": (T | null)[]; + + /** Creates a new OtherPerson instance. */ + constructor($$source: Partial> = {}) { + if (!("Name" in $$source)) { + this["Name"] = ""; + } + if (!("Differences" in $$source)) { + this["Differences"] = []; + } + + Object.assign(this, $$source); + } + + /** + * Given creation functions for each type parameter, + * returns a creation function for a concrete instance + * of the generic class OtherPerson. + */ + static createFrom($$createParamT: (source: any) => T): ($$source?: any) => OtherPerson { + const $$createField1_0 = $$createType0($$createParamT); + return ($$source: any = {}) => { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Differences" in $$parsedSource) { + $$parsedSource["Differences"] = $$createField1_0($$parsedSource["Differences"]); + } + return new OtherPerson($$parsedSource as Partial>); + }; + } +} + +// Private type creation functions +const $$createType0 = ($$createParamT) => $Create.Array($$createParamT); diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/models.ts index 59343c53e2f..01eb4cbda56 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/models.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/models.ts @@ -1,52 +1,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import {Create as $Create} from "/wails/runtime.js"; - -/** - * OtherPerson is like a person, but different. - */ -export class OtherPerson { - /** - * They have a name as well. - */ - "Name": string; - - /** - * But they may have many differences. - */ - "Differences": (T | null)[]; - - /** Creates a new OtherPerson instance. */ - constructor($$source: Partial> = {}) { - if (!("Name" in $$source)) { - this["Name"] = ""; - } - if (!("Differences" in $$source)) { - this["Differences"] = []; - } - - Object.assign(this, $$source); - } - - /** - * Given creation functions for each type parameter, - * returns a creation function for a concrete instance - * of the generic class OtherPerson. - */ - static createFrom($$createParamT: (source: any) => T): ($$source?: any) => OtherPerson { - const $$createField1_0 = $$createType0($$createParamT); - return ($$source: any = {}) => { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - if ("Differences" in $$parsedSource) { - $$parsedSource["Differences"] = $$createField1_0($$parsedSource["Differences"]); - } - return new OtherPerson($$parsedSource as Partial>); - }; - } -} - -// Private type creation functions -const $$createType0 = ($$createParamT) => $Create.Array($$createParamT); +export { + OtherPerson +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/somemethods.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/somemethods.ts index bb81a68d1e4..89798335349 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/somemethods.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/somemethods.ts @@ -12,18 +12,17 @@ import {Call as $Call, Create as $Create} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * LikeThisOne is an example method that does nothing. */ -export function LikeThisOne(): Promise<[$models.Person, $models.Impersonator, $models.HowDifferent, $models.PrivatePerson]> & { cancel(): void } { +export function LikeThisOne(): Promise<[$models.Person, $models.HowDifferent, $models.PrivatePerson]> & { cancel(): void } { let $resultPromise = $Call.ByName("github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here.SomeMethods.LikeThisOne") as any; let $typingPromise = $resultPromise.then(($result: any) => { $result[0] = $$createType0($result[0]); $result[1] = $$createType1($result[1]); $result[2] = $$createType2($result[2]); - $result[3] = $$createType3($result[3]); return $result; }) as any; $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); @@ -40,6 +39,5 @@ export function LikeThisOtherOne(): Promise & { cancel(): void } { // Private type creation functions const $$createType0 = $models.Person.createFrom; -const $$createType1 = $models.Impersonator.createFrom; -const $$createType2 = $models.HowDifferent.createFrom($Create.Any); -const $$createType3 = $models.PrivatePerson.createFrom; +const $$createType1 = $models.HowDifferent.createFrom($Create.Any); +const $$createType2 = $models.PrivatePerson.createFrom; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/embedservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/embedservice.ts index e5a7fd0cfa2..be4455ca13d 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/embedservice.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/embedservice.ts @@ -17,13 +17,12 @@ import * as nobindingshere$0 from "../no_bindings_here/models.js"; /** * LikeThisOne is an example method that does nothing. */ -export function LikeThisOne(): Promise<[nobindingshere$0.Person, nobindingshere$0.Impersonator, nobindingshere$0.HowDifferent, nobindingshere$0.PrivatePerson]> & { cancel(): void } { +export function LikeThisOne(): Promise<[nobindingshere$0.Person, nobindingshere$0.HowDifferent, nobindingshere$0.PrivatePerson]> & { cancel(): void } { let $resultPromise = $Call.ByName("main.EmbedService.LikeThisOne") as any; let $typingPromise = $resultPromise.then(($result: any) => { $result[0] = $$createType0($result[0]); $result[1] = $$createType1($result[1]); $result[2] = $$createType2($result[2]); - $result[3] = $$createType3($result[3]); return $result; }) as any; $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); @@ -40,6 +39,5 @@ export function LikeThisOtherOne(): Promise & { cancel(): void } { // Private type creation functions const $$createType0 = nobindingshere$0.Person.createFrom; -const $$createType1 = nobindingshere$0.Impersonator.createFrom; -const $$createType2 = nobindingshere$0.HowDifferent.createFrom($Create.Any); -const $$createType3 = nobindingshere$0.PrivatePerson.createFrom; +const $$createType1 = nobindingshere$0.HowDifferent.createFrom($Create.Any); +const $$createType2 = nobindingshere$0.PrivatePerson.createFrom; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/greetservice.ts index 49c20faa362..d7dea4fbabb 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/greetservice.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/greetservice.ts @@ -12,7 +12,7 @@ import {Call as $Call, Create as $Create} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Greet does XYZ diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/internal.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/internal.ts new file mode 100644 index 00000000000..474248f2e36 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/internal.ts @@ -0,0 +1,43 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Create as $Create} from "/wails/runtime.js"; + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import * as services$0 from "./services/models.js"; + +export class Person { + "Name": string; + "Address": services$0.Address | null; + + /** Creates a new Person instance. */ + constructor($$source: Partial = {}) { + if (!("Name" in $$source)) { + this["Name"] = ""; + } + if (!("Address" in $$source)) { + this["Address"] = null; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + */ + static createFrom($$source: any = {}): Person { + const $$createField1_0 = $$createType1; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Address" in $$parsedSource) { + $$parsedSource["Address"] = $$createField1_0($$parsedSource["Address"]); + } + return new Person($$parsedSource as Partial); + } +} + +// Private type creation functions +const $$createType0 = services$0.Address.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/models.ts index 474248f2e36..af848881144 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/models.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/models.ts @@ -1,43 +1,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import {Create as $Create} from "/wails/runtime.js"; - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as services$0 from "./services/models.js"; - -export class Person { - "Name": string; - "Address": services$0.Address | null; - - /** Creates a new Person instance. */ - constructor($$source: Partial = {}) { - if (!("Name" in $$source)) { - this["Name"] = ""; - } - if (!("Address" in $$source)) { - this["Address"] = null; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new Person instance from a string or object. - */ - static createFrom($$source: any = {}): Person { - const $$createField1_0 = $$createType1; - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - if ("Address" in $$parsedSource) { - $$parsedSource["Address"] = $$createField1_0($$parsedSource["Address"]); - } - return new Person($$parsedSource as Partial); - } -} - -// Private type creation functions -const $$createType0 = services$0.Address.createFrom; -const $$createType1 = $Create.Nullable($$createType0); +export { + Person +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/internal.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/internal.ts new file mode 100644 index 00000000000..eb9c1b6bf51 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/internal.ts @@ -0,0 +1,35 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Create as $Create} from "/wails/runtime.js"; + +export class Address { + "Street": string; + "State": string; + "Country": string; + + /** Creates a new Address instance. */ + constructor($$source: Partial
= {}) { + if (!("Street" in $$source)) { + this["Street"] = ""; + } + if (!("State" in $$source)) { + this["State"] = ""; + } + if (!("Country" in $$source)) { + this["Country"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Address instance from a string or object. + */ + static createFrom($$source: any = {}): Address { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new Address($$parsedSource as Partial
); + } +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/models.ts index eb9c1b6bf51..82637788023 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/models.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/models.ts @@ -1,35 +1,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import {Create as $Create} from "/wails/runtime.js"; - -export class Address { - "Street": string; - "State": string; - "Country": string; - - /** Creates a new Address instance. */ - constructor($$source: Partial
= {}) { - if (!("Street" in $$source)) { - this["Street"] = ""; - } - if (!("State" in $$source)) { - this["State"] = ""; - } - if (!("Country" in $$source)) { - this["Country"] = ""; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new Address instance from a string or object. - */ - static createFrom($$source: any = {}): Address { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - return new Address($$parsedSource as Partial
); - } -} +export { + Address +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/otherservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/otherservice.ts index 3c2901c2c0d..f83cc437344 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/otherservice.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/otherservice.ts @@ -13,7 +13,7 @@ import {Call as $Call, Create as $Create} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Yay does this and that diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/greetservice.ts index 1d93cea347c..637e0470215 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/greetservice.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/greetservice.ts @@ -12,7 +12,7 @@ import {Call as $Call, Create as $Create} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; export function ArrayInt($in: number[]): Promise & { cancel(): void } { let $resultPromise = $Call.ByName("main.GreetService.ArrayInt", $in) as any; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/internal.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/internal.ts new file mode 100644 index 00000000000..3dd1908e176 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/internal.ts @@ -0,0 +1,43 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Create as $Create} from "/wails/runtime.js"; + +export class Person { + "Name": string; + "Parent": Person | null; + "Details": {"Age": number, "Address": {"Street": string}}; + + /** Creates a new Person instance. */ + constructor($$source: Partial = {}) { + if (!("Name" in $$source)) { + this["Name"] = ""; + } + if (!("Parent" in $$source)) { + this["Parent"] = null; + } + if (!("Details" in $$source)) { + this["Details"] = {"Age": 0, "Address": {"Street": ""}}; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + */ + static createFrom($$source: any = {}): Person { + const $$createField1_0 = $$createType1; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Parent" in $$parsedSource) { + $$parsedSource["Parent"] = $$createField1_0($$parsedSource["Parent"]); + } + return new Person($$parsedSource as Partial); + } +} + +// Private type creation functions +const $$createType0 = Person.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/models.ts index 3dd1908e176..af848881144 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/models.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/models.ts @@ -1,43 +1,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import {Create as $Create} from "/wails/runtime.js"; - -export class Person { - "Name": string; - "Parent": Person | null; - "Details": {"Age": number, "Address": {"Street": string}}; - - /** Creates a new Person instance. */ - constructor($$source: Partial = {}) { - if (!("Name" in $$source)) { - this["Name"] = ""; - } - if (!("Parent" in $$source)) { - this["Parent"] = null; - } - if (!("Details" in $$source)) { - this["Details"] = {"Age": 0, "Address": {"Street": ""}}; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new Person instance from a string or object. - */ - static createFrom($$source: any = {}): Person { - const $$createField1_0 = $$createType1; - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - if ("Parent" in $$parsedSource) { - $$parsedSource["Parent"] = $$createField1_0($$parsedSource["Parent"]); - } - return new Person($$parsedSource as Partial); - } -} - -// Private type creation functions -const $$createType0 = Person.createFrom; -const $$createType1 = $Create.Nullable($$createType0); +export { + Person +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/greetservice.ts index 1d93cea347c..637e0470215 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/greetservice.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/greetservice.ts @@ -12,7 +12,7 @@ import {Call as $Call, Create as $Create} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; export function ArrayInt($in: number[]): Promise & { cancel(): void } { let $resultPromise = $Call.ByName("main.GreetService.ArrayInt", $in) as any; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/internal.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/internal.ts new file mode 100644 index 00000000000..3dd1908e176 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/internal.ts @@ -0,0 +1,43 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Create as $Create} from "/wails/runtime.js"; + +export class Person { + "Name": string; + "Parent": Person | null; + "Details": {"Age": number, "Address": {"Street": string}}; + + /** Creates a new Person instance. */ + constructor($$source: Partial = {}) { + if (!("Name" in $$source)) { + this["Name"] = ""; + } + if (!("Parent" in $$source)) { + this["Parent"] = null; + } + if (!("Details" in $$source)) { + this["Details"] = {"Age": 0, "Address": {"Street": ""}}; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + */ + static createFrom($$source: any = {}): Person { + const $$createField1_0 = $$createType1; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Parent" in $$parsedSource) { + $$parsedSource["Parent"] = $$createField1_0($$parsedSource["Parent"]); + } + return new Person($$parsedSource as Partial); + } +} + +// Private type creation functions +const $$createType0 = Person.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/models.ts index 3dd1908e176..af848881144 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/models.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/models.ts @@ -1,43 +1,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import {Create as $Create} from "/wails/runtime.js"; - -export class Person { - "Name": string; - "Parent": Person | null; - "Details": {"Age": number, "Address": {"Street": string}}; - - /** Creates a new Person instance. */ - constructor($$source: Partial = {}) { - if (!("Name" in $$source)) { - this["Name"] = ""; - } - if (!("Parent" in $$source)) { - this["Parent"] = null; - } - if (!("Details" in $$source)) { - this["Details"] = {"Age": 0, "Address": {"Street": ""}}; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new Person instance from a string or object. - */ - static createFrom($$source: any = {}): Person { - const $$createField1_0 = $$createType1; - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - if ("Parent" in $$parsedSource) { - $$parsedSource["Parent"] = $$createField1_0($$parsedSource["Parent"]); - } - return new Person($$parsedSource as Partial); - } -} - -// Private type creation functions -const $$createType0 = Person.createFrom; -const $$createType1 = $Create.Nullable($$createType0); +export { + Person +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/greetservice.ts index 49c20faa362..d7dea4fbabb 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/greetservice.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/greetservice.ts @@ -12,7 +12,7 @@ import {Call as $Call, Create as $Create} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Greet does XYZ diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/internal.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/internal.ts new file mode 100644 index 00000000000..4442874d2a9 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/internal.ts @@ -0,0 +1,47 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Create as $Create} from "/wails/runtime.js"; + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import * as services$0 from "./services/models.js"; + +/** + * Person is a person! + * They have a name and an address + */ +export class Person { + "Name": string; + "Address": services$0.Address | null; + + /** Creates a new Person instance. */ + constructor($$source: Partial = {}) { + if (!("Name" in $$source)) { + this["Name"] = ""; + } + if (!("Address" in $$source)) { + this["Address"] = null; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + */ + static createFrom($$source: any = {}): Person { + const $$createField1_0 = $$createType1; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Address" in $$parsedSource) { + $$parsedSource["Address"] = $$createField1_0($$parsedSource["Address"]); + } + return new Person($$parsedSource as Partial); + } +} + +// Private type creation functions +const $$createType0 = services$0.Address.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/models.ts index 4442874d2a9..af848881144 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/models.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/models.ts @@ -1,47 +1,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import {Create as $Create} from "/wails/runtime.js"; - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as services$0 from "./services/models.js"; - -/** - * Person is a person! - * They have a name and an address - */ -export class Person { - "Name": string; - "Address": services$0.Address | null; - - /** Creates a new Person instance. */ - constructor($$source: Partial = {}) { - if (!("Name" in $$source)) { - this["Name"] = ""; - } - if (!("Address" in $$source)) { - this["Address"] = null; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new Person instance from a string or object. - */ - static createFrom($$source: any = {}): Person { - const $$createField1_0 = $$createType1; - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - if ("Address" in $$parsedSource) { - $$parsedSource["Address"] = $$createField1_0($$parsedSource["Address"]); - } - return new Person($$parsedSource as Partial); - } -} - -// Private type creation functions -const $$createType0 = services$0.Address.createFrom; -const $$createType1 = $Create.Nullable($$createType0); +export { + Person +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/internal.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/internal.ts new file mode 100644 index 00000000000..eb9c1b6bf51 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/internal.ts @@ -0,0 +1,35 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Create as $Create} from "/wails/runtime.js"; + +export class Address { + "Street": string; + "State": string; + "Country": string; + + /** Creates a new Address instance. */ + constructor($$source: Partial
= {}) { + if (!("Street" in $$source)) { + this["Street"] = ""; + } + if (!("State" in $$source)) { + this["State"] = ""; + } + if (!("Country" in $$source)) { + this["Country"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Address instance from a string or object. + */ + static createFrom($$source: any = {}): Address { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new Address($$parsedSource as Partial
); + } +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/models.ts index eb9c1b6bf51..82637788023 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/models.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/models.ts @@ -1,35 +1,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import {Create as $Create} from "/wails/runtime.js"; - -export class Address { - "Street": string; - "State": string; - "Country": string; - - /** Creates a new Address instance. */ - constructor($$source: Partial
= {}) { - if (!("Street" in $$source)) { - this["Street"] = ""; - } - if (!("State" in $$source)) { - this["State"] = ""; - } - if (!("Country" in $$source)) { - this["Country"] = ""; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new Address instance from a string or object. - */ - static createFrom($$source: any = {}): Address { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - return new Address($$parsedSource as Partial
); - } -} +export { + Address +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/otherservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/otherservice.ts index 641595e74f3..ab404cbb37b 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/otherservice.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/otherservice.ts @@ -13,7 +13,7 @@ import {Call as $Call, Create as $Create} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Yay does this and that diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/greetservice.ts index 432fef1d46d..a63c49bc5ed 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/greetservice.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/greetservice.ts @@ -12,10 +12,10 @@ import {Call as $Call} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** - * Get someone + * Get someone. */ export function Get(aliasValue: $models.Alias): Promise<$models.Person> & { cancel(): void } { let $resultPromise = $Call.ByID(1928502664, aliasValue) as any; @@ -23,7 +23,15 @@ export function Get(aliasValue: $models.Alias): Promise<$models.Person> & { canc } /** - * Get someone quite different + * Apparently, aliases are all the rage right now. + */ +export function GetButAliased(p: $models.AliasedPerson): Promise<$models.StrangelyAliasedPerson> & { cancel(): void } { + let $resultPromise = $Call.ByID(1896499664, p) as any; + return $resultPromise; +} + +/** + * Get someone quite different. */ export function GetButDifferent(): Promise<$models.GenericPerson> & { cancel(): void } { let $resultPromise = $Call.ByID(2240931744) as any; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/internal.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/internal.ts new file mode 100644 index 00000000000..2e7590270f5 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/internal.ts @@ -0,0 +1,81 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * A nice type Alias. + */ +export type Alias = number; + +/** + * A struct alias. + * This should be rendered as a typedef or interface in every mode. + */ +export interface AliasStruct { + /** + * A field with a comment. + */ + "Foo": number[] | null; + + /** + * Definitely not Foo. + */ + "Bar"?: string; + "Baz"?: string; + + /** + * A nested alias struct. + */ + "Other": OtherAliasStruct; +} + +/** + * A class alias. + */ +export type AliasedPerson = Person; + +/** + * An empty struct alias. + */ +export interface EmptyAliasStruct { +} + +/** + * An empty struct. + */ +export interface EmptyStruct { +} + +/** + * A generic struct containing an alias. + */ +export interface GenericPerson { + "Name": T | null; + "AliasedField": Alias; +} + +/** + * Another struct alias. + */ +export interface OtherAliasStruct { + "NoMoreIdeas": number[] | null; +} + +/** + * A non-generic struct containing an alias. + */ +export interface Person { + /** + * The Person's name. + */ + "Name": string; + + /** + * A random alias field. + */ + "AliasedField": Alias; +} + +/** + * Another class alias, but ordered after its aliased class. + */ +export type StrangelyAliasedPerson = Person; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/models.ts index 188fd6de19a..564f2b548b8 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/models.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/models.ts @@ -1,72 +1,14 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT - -/** - * A nice type Alias - */ -export type Alias = number; - -/** - * A struct alias. - * This should be rendered as a typedef or interface in every mode. - */ -export interface AliasStruct { - /** - * A field with a comment. - */ - "Foo": number[] | null; - - /** - * Definitely not Foo. - */ - "Bar"?: string; - "Baz"?: string; - - /** - * A nested alias struct. - */ - "Other": OtherAliasStruct; -} - -/** - * An empty struct alias. - */ -export interface EmptyAliasStruct { -} - -/** - * An empty struct. - */ -export interface EmptyStruct { -} - -/** - * A generic struct containing an alias - */ -export interface GenericPerson { - "Name": T | null; - "AliasedField": Alias; -} - -/** - * Another struct alias. - */ -export interface OtherAliasStruct { - "NoMoreIdeas": number[] | null; -} - -/** - * A non-generic struct containing an alias. - */ -export interface Person { - /** - * The Person's name. - */ - "Name": string; - - /** - * A random alias field. - */ - "AliasedField": Alias; -} +export type { + Alias, + AliasStruct, + AliasedPerson, + EmptyAliasStruct, + EmptyStruct, + GenericPerson, + OtherAliasStruct, + Person, + StrangelyAliasedPerson +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/greetservice.ts index 32b85fccb5d..b0ad675d969 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/greetservice.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/greetservice.ts @@ -12,7 +12,7 @@ import {Call as $Call} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Greet does XYZ diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/internal.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/internal.ts index 0934fa47f34..7cdb88164d4 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/internal.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/internal.ts @@ -1,6 +1,110 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT +export interface Embedded1 { + /** + * Friends should be shadowed in Person by a field of lesser depth + */ + "Friends": number; + + /** + * Vanish should be omitted from Person because there is another field with same depth and no tag + */ + "Vanish": number; + + /** + * StillThere should be shadowed in Person by other field with same depth and a json tag + */ + "StillThere": string; + + /** + * NamingThingsIsHard is a law of programming + */ + "NamingThingsIsHard": `${boolean}`; +} + +export type Embedded3 = string; + +/** + * Person represents a person + */ +export interface Person { + /** + * Titles is optional in JSON + */ + "Titles"?: Title[] | null; + + /** + * Names has a + * multiline comment + */ + "Names": string[] | null; + + /** + * Partner has a custom and complex JSON key + */ + "Partner": Person | null; + "Friends": (Person | null)[] | null; + + /** + * NamingThingsIsHard is a law of programming + */ + "NamingThingsIsHard": `${boolean}`; + + /** + * StillThereButRenamed should shadow in Person the other field with same depth and no json tag + */ + "StillThere": Embedded3 | null; + + /** + * StrangeNumber maps to "-" + */ + "-": number; + + /** + * Embedded3 should appear with key "Embedded3" + */ + "Embedded3": Embedded3; + + /** + * StrangerNumber is serialized as a string + */ + "StrangerNumber": `${number}`; + + /** + * StrangestString is optional and serialized as a JSON string + */ + "StrangestString"?: `"${string}"`; + + /** + * StringStrangest is serialized as a JSON string and optional + */ + "StringStrangest"?: `"${string}"`; + + /** + * embedded4 should be optional and appear with key "emb4" + */ + "emb4"?: embedded4; +} + +/** + * Title is a title + */ +export enum Title { + /** + * The Go zero value for the underlying type of the enum. + */ + $zero = "", + + /** + * Mister is a title + */ + Mister = "Mr", + Miss = "Miss", + Ms = "Ms", + Mrs = "Mrs", + Dr = "Dr", +}; export interface embedded4 { /** diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/models.ts index d658f2d5815..34aee6781e1 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/models.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/models.ts @@ -1,112 +1,12 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as $internal from "./internal.js"; - -export interface Embedded1 { - /** - * Friends should be shadowed in Person by a field of lesser depth - */ - "Friends": number; - - /** - * Vanish should be omitted from Person because there is another field with same depth and no tag - */ - "Vanish": number; - - /** - * StillThere should be shadowed in Person by other field with same depth and a json tag - */ - "StillThere": string; - - /** - * NamingThingsIsHard is a law of programming - */ - "NamingThingsIsHard": `${boolean}`; -} - -export type Embedded3 = string; - -/** - * Person represents a person - */ -export interface Person { - /** - * Titles is optional in JSON - */ - "Titles"?: Title[] | null; - - /** - * Names has a - * multiline comment - */ - "Names": string[] | null; - - /** - * Partner has a custom and complex JSON key - */ - "Partner": Person | null; - "Friends": (Person | null)[] | null; - - /** - * NamingThingsIsHard is a law of programming - */ - "NamingThingsIsHard": `${boolean}`; - - /** - * StillThereButRenamed should shadow in Person the other field with same depth and no json tag - */ - "StillThere": Embedded3 | null; - - /** - * StrangeNumber maps to "-" - */ - "-": number; - - /** - * Embedded3 should appear with key "Embedded3" - */ - "Embedded3": Embedded3; - - /** - * StrangerNumber is serialized as a string - */ - "StrangerNumber": `${number}`; - - /** - * StrangestString is optional and serialized as a JSON string - */ - "StrangestString"?: `"${string}"`; - - /** - * StringStrangest is serialized as a JSON string and optional - */ - "StringStrangest"?: `"${string}"`; - - /** - * embedded4 should be optional and appear with key "emb4" - */ - "emb4"?: $internal.embedded4; -} - -/** - * Title is a title - */ -export enum Title { - /** - * The Go zero value for the underlying type of the enum. - */ - $zero = "", - - /** - * Mister is a title - */ - Mister = "Mr", - Miss = "Miss", - Ms = "Ms", - Mrs = "Mrs", - Dr = "Dr", -}; +export { + Title +} from "./internal.js"; + +export type { + Embedded1, + Embedded3, + Person +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/greetservice.ts index 05fa84c0c64..e4df5ba19d3 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/greetservice.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/greetservice.ts @@ -12,7 +12,7 @@ import {Call as $Call} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Greet does XYZ diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/internal.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/internal.ts new file mode 100644 index 00000000000..6691fb86ceb --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/internal.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * Person represents a person + */ +export interface Person { + "Name": string; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/models.ts index ddba4f7ab58..b27d0d189cc 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/models.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/models.ts @@ -1,10 +1,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT - -/** - * Person represents a person - */ -export interface Person { - "Name": string; -} +export type { + Person +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/greetservice.ts new file mode 100644 index 00000000000..d01733be6f2 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/greetservice.ts @@ -0,0 +1,23 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Call as $Call} from "/wails/runtime.js"; + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import * as $models from "./internal.js"; + +/** + * Make a cycle. + */ +export function MakeCycles(): Promise<[$models.StructA, $models.StructC]> & { cancel(): void } { + let $resultPromise = $Call.ByID(440020721) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/index.ts new file mode 100644 index 00000000000..8e624c8260f --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/internal.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/internal.ts new file mode 100644 index 00000000000..256987ac8a1 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/internal.ts @@ -0,0 +1,21 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +export interface StructA { + "B": structB | null; +} + +export interface StructC { + "D": structD; +} + +export interface StructE { +} + +export interface structB { + "A": StructA | null; +} + +export interface structD { + "E": StructE; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/models.ts new file mode 100644 index 00000000000..cae6922a9de --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/models.ts @@ -0,0 +1,8 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +export type { + StructA, + StructC, + StructE +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/greetservice.ts similarity index 93% rename from v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/greetservice.ts rename to v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/greetservice.ts index 43591429971..23e08fde4bc 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/greetservice.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/greetservice.ts @@ -12,7 +12,7 @@ import {Call as $Call} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Make a cycle. diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/index.ts new file mode 100644 index 00000000000..8e624c8260f --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/internal.ts similarity index 99% rename from v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/models.ts rename to v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/internal.ts index f2b4b583d73..b378c355031 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/models.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/internal.ts @@ -1,7 +1,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT - export type Alias = Cyclic | null; export type Cyclic = ({ [_: string]: Alias } | null)[] | null; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/models.ts new file mode 100644 index 00000000000..e4c8045036d --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/models.ts @@ -0,0 +1,8 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +export type { + Alias, + Cyclic, + GenericCyclic +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/greetservice.ts index 561d0b5c490..757e5a12507 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/greetservice.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/greetservice.ts @@ -12,7 +12,7 @@ import {Call as $Call} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Greet does XYZ diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/internal.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/internal.ts new file mode 100644 index 00000000000..7ac95c04692 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/internal.ts @@ -0,0 +1,29 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * Person represents a person + */ +export interface Person { + "Title": Title; + "Name": string; +} + +/** + * Title is a title + */ +export enum Title { + /** + * The Go zero value for the underlying type of the enum. + */ + $zero = "", + + /** + * Mister is a title + */ + Mister = "Mr", + Miss = "Miss", + Ms = "Ms", + Mrs = "Mrs", + Dr = "Dr", +}; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/models.ts index 1dc9b1859a0..224a055957d 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/models.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/models.ts @@ -1,30 +1,10 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT +export { + Title +} from "./internal.js"; -/** - * Person represents a person - */ -export interface Person { - "Title": Title; - "Name": string; -} - -/** - * Title is a title - */ -export enum Title { - /** - * The Go zero value for the underlying type of the enum. - */ - $zero = "", - - /** - * Mister is a title - */ - Mister = "Mr", - Miss = "Miss", - Ms = "Ms", - Mrs = "Mrs", - Dr = "Dr", -}; +export type { + Person +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/internal.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/internal.ts new file mode 100644 index 00000000000..887aee9ba63 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/internal.ts @@ -0,0 +1,18 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +export enum Title { + /** + * The Go zero value for the underlying type of the enum. + */ + $zero = "", + + /** + * Mister is a title + */ + Mister = "Mr", + Miss = "Miss", + Ms = "Ms", + Mrs = "Mrs", + Dr = "Dr", +}; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/models.ts index ad6a1e62d5b..e8981fc5e89 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/models.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/models.ts @@ -1,19 +1,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT - -export enum Title { - /** - * The Go zero value for the underlying type of the enum. - */ - $zero = "", - - /** - * Mister is a title - */ - Mister = "Mr", - Miss = "Miss", - Ms = "Ms", - Mrs = "Mrs", - Dr = "Dr", -}; +export { + Title +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/greetservice.ts index c649bfb8260..c2b76d80635 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/greetservice.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/greetservice.ts @@ -12,7 +12,7 @@ import {Call as $Call} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Greet does XYZ diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/internal.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/internal.ts new file mode 100644 index 00000000000..99b989f076b --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/internal.ts @@ -0,0 +1,14 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import * as services$0 from "./services/models.js"; + +/** + * Person is a person + */ +export interface Person { + "Name": string; + "Address": services$0.Address | null; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/models.ts index 2027326ed3f..b27d0d189cc 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/models.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/models.ts @@ -1,15 +1,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as services$0 from "./services/models.js"; - -/** - * Person is a person - */ -export interface Person { - "Name": string; - "Address": services$0.Address | null; -} +export type { + Person +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/internal.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/internal.ts new file mode 100644 index 00000000000..b76080cf398 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/internal.ts @@ -0,0 +1,8 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +export interface Address { + "Street": string; + "State": string; + "Country": string; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/models.ts index 964e2d6c722..da9b10c49bc 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/models.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/models.ts @@ -1,9 +1,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT - -export interface Address { - "Street": string; - "State": string; - "Country": string; -} +export type { + Address +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/otherservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/otherservice.ts index 5fb794ba259..824e463aa0e 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/otherservice.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/otherservice.ts @@ -13,7 +13,7 @@ import {Call as $Call} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Yay does this and that diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/greetservice.ts index c649bfb8260..c2b76d80635 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/greetservice.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/greetservice.ts @@ -12,7 +12,7 @@ import {Call as $Call} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Greet does XYZ diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/internal.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/internal.ts new file mode 100644 index 00000000000..70b85519b94 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/internal.ts @@ -0,0 +1,11 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import * as other$0 from "./services/other/models.js"; + +export interface Person { + "Name": string; + "Address": other$0.Address | null; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/models.ts index d506fb70b68..b27d0d189cc 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/models.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/models.ts @@ -1,12 +1,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as other$0 from "./services/other/models.js"; - -export interface Person { - "Name": string; - "Address": other$0.Address | null; -} +export type { + Person +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/internal.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/internal.ts new file mode 100644 index 00000000000..b76080cf398 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/internal.ts @@ -0,0 +1,8 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +export interface Address { + "Street": string; + "State": string; + "Country": string; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/models.ts index 964e2d6c722..da9b10c49bc 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/models.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/models.ts @@ -1,9 +1,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT - -export interface Address { - "Street": string; - "State": string; - "Country": string; -} +export type { + Address +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/otherservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/otherservice.ts index 23b854905f5..1d7abd64276 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/otherservice.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/otherservice.ts @@ -13,7 +13,7 @@ import {Call as $Call} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Yay does this and that diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_internal/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_internal/greetservice.ts new file mode 100644 index 00000000000..dc0a1a1b8f8 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_internal/greetservice.ts @@ -0,0 +1,19 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Call as $Call} from "/wails/runtime.js"; + +/** + * Greet someone + */ +export function Greet(name: string): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1411160069, name) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_internal/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_internal/index.ts new file mode 100644 index 00000000000..50e3f043598 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_internal/index.ts @@ -0,0 +1,7 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/internal.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/internal.ts index 3be70d0b37b..35a843ab0bb 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/internal.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/internal.ts @@ -1,6 +1,40 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import * as other$0 from "./other/models.js"; + +/** + * HowDifferent is a curious kind of person + * that lets other people decide how they are different. + */ +export type HowDifferent = other$0.OtherPerson<{ [_: string]: How | null } | null>; + +/** + * Impersonator gets their fields from other people. + */ +export type Impersonator = other$0.OtherPerson; + +/** + * Person is not a number. + */ +export interface Person { + /** + * They have a name. + */ + "Name": string; + + /** + * Exactly 4 sketchy friends. + */ + "Friends": Impersonator[]; +} + +/** + * PrivatePerson gets their fields from hidden sources. + */ +export type PrivatePerson = personImpl; export interface personImpl { /** @@ -12,4 +46,9 @@ export interface personImpl { * They have a name. */ "Name": string; + + /** + * Exactly 4 sketchy friends. + */ + "Friends": Impersonator[]; } diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/models.ts index 1ff76816d6b..9e517b64401 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/models.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/models.ts @@ -1,37 +1,9 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as other$0 from "./other/models.js"; - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as $internal from "./internal.js"; - -/** - * HowDifferent is a curious kind of person - * that lets other people decide how they are different. - */ -export type HowDifferent = other$0.OtherPerson<{ [_: string]: How | null } | null>; - -/** - * Impersonator gets their fields from other people. - */ -export type Impersonator = other$0.OtherPerson; - -/** - * Person is not a number. - */ -export interface Person { - /** - * They have a name. - */ - "Name": string; -} - -/** - * PrivatePerson gets their fields from hidden sources. - */ -export type PrivatePerson = $internal.personImpl; +export type { + HowDifferent, + Impersonator, + Person, + PrivatePerson +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/internal.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/internal.ts new file mode 100644 index 00000000000..756721e0f10 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/internal.ts @@ -0,0 +1,17 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * OtherPerson is like a person, but different. + */ +export interface OtherPerson { + /** + * They have a name as well. + */ + "Name": string; + + /** + * But they may have many differences. + */ + "Differences": (T | null)[] | null; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/models.ts index c7286bd9e61..596daa5b585 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/models.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/models.ts @@ -1,18 +1,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT - -/** - * OtherPerson is like a person, but different. - */ -export interface OtherPerson { - /** - * They have a name as well. - */ - "Name": string; - - /** - * But they may have many differences. - */ - "Differences": (T | null)[] | null; -} +export type { + OtherPerson +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/somemethods.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/somemethods.ts index 921576583d4..5a21244eb73 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/somemethods.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/somemethods.ts @@ -12,12 +12,12 @@ import {Call as $Call} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * LikeThisOne is an example method that does nothing. */ -export function LikeThisOne(): Promise<[$models.Person, $models.Impersonator, $models.HowDifferent, $models.PrivatePerson]> & { cancel(): void } { +export function LikeThisOne(): Promise<[$models.Person, $models.HowDifferent, $models.PrivatePerson]> & { cancel(): void } { let $resultPromise = $Call.ByID(2124352079) as any; return $resultPromise; } diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/embedservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/embedservice.ts index a860d3f61c5..f757ceeae12 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/embedservice.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/embedservice.ts @@ -17,7 +17,7 @@ import * as nobindingshere$0 from "../no_bindings_here/models.js"; /** * LikeThisOne is an example method that does nothing. */ -export function LikeThisOne(): Promise<[nobindingshere$0.Person, nobindingshere$0.Impersonator, nobindingshere$0.HowDifferent, nobindingshere$0.PrivatePerson]> & { cancel(): void } { +export function LikeThisOne(): Promise<[nobindingshere$0.Person, nobindingshere$0.HowDifferent, nobindingshere$0.PrivatePerson]> & { cancel(): void } { let $resultPromise = $Call.ByID(2590614085) as any; return $resultPromise; } diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/greetservice.ts index c649bfb8260..c2b76d80635 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/greetservice.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/greetservice.ts @@ -12,7 +12,7 @@ import {Call as $Call} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Greet does XYZ diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/internal.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/internal.ts new file mode 100644 index 00000000000..3ab21d612ed --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/internal.ts @@ -0,0 +1,11 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import * as services$0 from "./services/models.js"; + +export interface Person { + "Name": string; + "Address": services$0.Address | null; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/models.ts index b09de778353..b27d0d189cc 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/models.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/models.ts @@ -1,12 +1,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as services$0 from "./services/models.js"; - -export interface Person { - "Name": string; - "Address": services$0.Address | null; -} +export type { + Person +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/internal.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/internal.ts new file mode 100644 index 00000000000..b76080cf398 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/internal.ts @@ -0,0 +1,8 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +export interface Address { + "Street": string; + "State": string; + "Country": string; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/models.ts index 964e2d6c722..da9b10c49bc 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/models.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/models.ts @@ -1,9 +1,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT - -export interface Address { - "Street": string; - "State": string; - "Country": string; -} +export type { + Address +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/otherservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/otherservice.ts index d8ddc9193fa..fcbad044f26 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/otherservice.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/otherservice.ts @@ -13,7 +13,7 @@ import {Call as $Call} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Yay does this and that diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/greetservice.ts index a9881e00f39..25e0a285602 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/greetservice.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/greetservice.ts @@ -12,7 +12,7 @@ import {Call as $Call} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; export function ArrayInt($in: number[]): Promise & { cancel(): void } { let $resultPromise = $Call.ByID(3862002418, $in) as any; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/internal.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/internal.ts new file mode 100644 index 00000000000..5664b79abdf --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/internal.ts @@ -0,0 +1,8 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +export interface Person { + "Name": string; + "Parent": Person | null; + "Details": {"Age": number, "Address": {"Street": string}}; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/models.ts index 9b48e7941d5..b27d0d189cc 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/models.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/models.ts @@ -1,9 +1,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT - -export interface Person { - "Name": string; - "Parent": Person | null; - "Details": {"Age": number, "Address": {"Street": string}}; -} +export type { + Person +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/greetservice.ts index a9881e00f39..25e0a285602 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/greetservice.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/greetservice.ts @@ -12,7 +12,7 @@ import {Call as $Call} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; export function ArrayInt($in: number[]): Promise & { cancel(): void } { let $resultPromise = $Call.ByID(3862002418, $in) as any; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/internal.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/internal.ts new file mode 100644 index 00000000000..5664b79abdf --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/internal.ts @@ -0,0 +1,8 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +export interface Person { + "Name": string; + "Parent": Person | null; + "Details": {"Age": number, "Address": {"Street": string}}; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/models.ts index 9b48e7941d5..b27d0d189cc 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/models.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/models.ts @@ -1,9 +1,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT - -export interface Person { - "Name": string; - "Parent": Person | null; - "Details": {"Age": number, "Address": {"Street": string}}; -} +export type { + Person +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/greetservice.ts index c649bfb8260..c2b76d80635 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/greetservice.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/greetservice.ts @@ -12,7 +12,7 @@ import {Call as $Call} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Greet does XYZ diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/internal.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/internal.ts new file mode 100644 index 00000000000..f2911720356 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/internal.ts @@ -0,0 +1,15 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import * as services$0 from "./services/models.js"; + +/** + * Person is a person! + * They have a name and an address + */ +export interface Person { + "Name": string; + "Address": services$0.Address | null; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/models.ts index cd4ae5e82e1..b27d0d189cc 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/models.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/models.ts @@ -1,16 +1,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as services$0 from "./services/models.js"; - -/** - * Person is a person! - * They have a name and an address - */ -export interface Person { - "Name": string; - "Address": services$0.Address | null; -} +export type { + Person +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/internal.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/internal.ts new file mode 100644 index 00000000000..b76080cf398 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/internal.ts @@ -0,0 +1,8 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +export interface Address { + "Street": string; + "State": string; + "Country": string; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/models.ts index 964e2d6c722..da9b10c49bc 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/models.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/models.ts @@ -1,9 +1,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT - -export interface Address { - "Street": string; - "State": string; - "Country": string; -} +export type { + Address +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/otherservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/otherservice.ts index 0fdb6e4c678..b619fa79b5a 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/otherservice.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/otherservice.ts @@ -13,7 +13,7 @@ import {Call as $Call} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Yay does this and that diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/greetservice.ts index 19f572bb610..efda674e402 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/greetservice.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/greetservice.ts @@ -12,10 +12,10 @@ import {Call as $Call} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** - * Get someone + * Get someone. */ export function Get(aliasValue: $models.Alias): Promise<$models.Person> & { cancel(): void } { let $resultPromise = $Call.ByName("main.GreetService.Get", aliasValue) as any; @@ -23,7 +23,15 @@ export function Get(aliasValue: $models.Alias): Promise<$models.Person> & { canc } /** - * Get someone quite different + * Apparently, aliases are all the rage right now. + */ +export function GetButAliased(p: $models.AliasedPerson): Promise<$models.StrangelyAliasedPerson> & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.GetButAliased", p) as any; + return $resultPromise; +} + +/** + * Get someone quite different. */ export function GetButDifferent(): Promise<$models.GenericPerson> & { cancel(): void } { let $resultPromise = $Call.ByName("main.GreetService.GetButDifferent") as any; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/internal.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/internal.ts new file mode 100644 index 00000000000..2e7590270f5 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/internal.ts @@ -0,0 +1,81 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * A nice type Alias. + */ +export type Alias = number; + +/** + * A struct alias. + * This should be rendered as a typedef or interface in every mode. + */ +export interface AliasStruct { + /** + * A field with a comment. + */ + "Foo": number[] | null; + + /** + * Definitely not Foo. + */ + "Bar"?: string; + "Baz"?: string; + + /** + * A nested alias struct. + */ + "Other": OtherAliasStruct; +} + +/** + * A class alias. + */ +export type AliasedPerson = Person; + +/** + * An empty struct alias. + */ +export interface EmptyAliasStruct { +} + +/** + * An empty struct. + */ +export interface EmptyStruct { +} + +/** + * A generic struct containing an alias. + */ +export interface GenericPerson { + "Name": T | null; + "AliasedField": Alias; +} + +/** + * Another struct alias. + */ +export interface OtherAliasStruct { + "NoMoreIdeas": number[] | null; +} + +/** + * A non-generic struct containing an alias. + */ +export interface Person { + /** + * The Person's name. + */ + "Name": string; + + /** + * A random alias field. + */ + "AliasedField": Alias; +} + +/** + * Another class alias, but ordered after its aliased class. + */ +export type StrangelyAliasedPerson = Person; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/models.ts index 188fd6de19a..564f2b548b8 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/models.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/models.ts @@ -1,72 +1,14 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT - -/** - * A nice type Alias - */ -export type Alias = number; - -/** - * A struct alias. - * This should be rendered as a typedef or interface in every mode. - */ -export interface AliasStruct { - /** - * A field with a comment. - */ - "Foo": number[] | null; - - /** - * Definitely not Foo. - */ - "Bar"?: string; - "Baz"?: string; - - /** - * A nested alias struct. - */ - "Other": OtherAliasStruct; -} - -/** - * An empty struct alias. - */ -export interface EmptyAliasStruct { -} - -/** - * An empty struct. - */ -export interface EmptyStruct { -} - -/** - * A generic struct containing an alias - */ -export interface GenericPerson { - "Name": T | null; - "AliasedField": Alias; -} - -/** - * Another struct alias. - */ -export interface OtherAliasStruct { - "NoMoreIdeas": number[] | null; -} - -/** - * A non-generic struct containing an alias. - */ -export interface Person { - /** - * The Person's name. - */ - "Name": string; - - /** - * A random alias field. - */ - "AliasedField": Alias; -} +export type { + Alias, + AliasStruct, + AliasedPerson, + EmptyAliasStruct, + EmptyStruct, + GenericPerson, + OtherAliasStruct, + Person, + StrangelyAliasedPerson +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/greetservice.ts index dde723eae68..81d63b298fe 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/greetservice.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/greetservice.ts @@ -12,7 +12,7 @@ import {Call as $Call} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Greet does XYZ diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/internal.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/internal.ts index 0934fa47f34..7cdb88164d4 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/internal.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/internal.ts @@ -1,6 +1,110 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT +export interface Embedded1 { + /** + * Friends should be shadowed in Person by a field of lesser depth + */ + "Friends": number; + + /** + * Vanish should be omitted from Person because there is another field with same depth and no tag + */ + "Vanish": number; + + /** + * StillThere should be shadowed in Person by other field with same depth and a json tag + */ + "StillThere": string; + + /** + * NamingThingsIsHard is a law of programming + */ + "NamingThingsIsHard": `${boolean}`; +} + +export type Embedded3 = string; + +/** + * Person represents a person + */ +export interface Person { + /** + * Titles is optional in JSON + */ + "Titles"?: Title[] | null; + + /** + * Names has a + * multiline comment + */ + "Names": string[] | null; + + /** + * Partner has a custom and complex JSON key + */ + "Partner": Person | null; + "Friends": (Person | null)[] | null; + + /** + * NamingThingsIsHard is a law of programming + */ + "NamingThingsIsHard": `${boolean}`; + + /** + * StillThereButRenamed should shadow in Person the other field with same depth and no json tag + */ + "StillThere": Embedded3 | null; + + /** + * StrangeNumber maps to "-" + */ + "-": number; + + /** + * Embedded3 should appear with key "Embedded3" + */ + "Embedded3": Embedded3; + + /** + * StrangerNumber is serialized as a string + */ + "StrangerNumber": `${number}`; + + /** + * StrangestString is optional and serialized as a JSON string + */ + "StrangestString"?: `"${string}"`; + + /** + * StringStrangest is serialized as a JSON string and optional + */ + "StringStrangest"?: `"${string}"`; + + /** + * embedded4 should be optional and appear with key "emb4" + */ + "emb4"?: embedded4; +} + +/** + * Title is a title + */ +export enum Title { + /** + * The Go zero value for the underlying type of the enum. + */ + $zero = "", + + /** + * Mister is a title + */ + Mister = "Mr", + Miss = "Miss", + Ms = "Ms", + Mrs = "Mrs", + Dr = "Dr", +}; export interface embedded4 { /** diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/models.ts index d658f2d5815..34aee6781e1 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/models.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/models.ts @@ -1,112 +1,12 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as $internal from "./internal.js"; - -export interface Embedded1 { - /** - * Friends should be shadowed in Person by a field of lesser depth - */ - "Friends": number; - - /** - * Vanish should be omitted from Person because there is another field with same depth and no tag - */ - "Vanish": number; - - /** - * StillThere should be shadowed in Person by other field with same depth and a json tag - */ - "StillThere": string; - - /** - * NamingThingsIsHard is a law of programming - */ - "NamingThingsIsHard": `${boolean}`; -} - -export type Embedded3 = string; - -/** - * Person represents a person - */ -export interface Person { - /** - * Titles is optional in JSON - */ - "Titles"?: Title[] | null; - - /** - * Names has a - * multiline comment - */ - "Names": string[] | null; - - /** - * Partner has a custom and complex JSON key - */ - "Partner": Person | null; - "Friends": (Person | null)[] | null; - - /** - * NamingThingsIsHard is a law of programming - */ - "NamingThingsIsHard": `${boolean}`; - - /** - * StillThereButRenamed should shadow in Person the other field with same depth and no json tag - */ - "StillThere": Embedded3 | null; - - /** - * StrangeNumber maps to "-" - */ - "-": number; - - /** - * Embedded3 should appear with key "Embedded3" - */ - "Embedded3": Embedded3; - - /** - * StrangerNumber is serialized as a string - */ - "StrangerNumber": `${number}`; - - /** - * StrangestString is optional and serialized as a JSON string - */ - "StrangestString"?: `"${string}"`; - - /** - * StringStrangest is serialized as a JSON string and optional - */ - "StringStrangest"?: `"${string}"`; - - /** - * embedded4 should be optional and appear with key "emb4" - */ - "emb4"?: $internal.embedded4; -} - -/** - * Title is a title - */ -export enum Title { - /** - * The Go zero value for the underlying type of the enum. - */ - $zero = "", - - /** - * Mister is a title - */ - Mister = "Mr", - Miss = "Miss", - Ms = "Ms", - Mrs = "Mrs", - Dr = "Dr", -}; +export { + Title +} from "./internal.js"; + +export type { + Embedded1, + Embedded3, + Person +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/greetservice.ts index c4b9cd802c5..6c8d19201c4 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/greetservice.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/greetservice.ts @@ -12,7 +12,7 @@ import {Call as $Call} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Greet does XYZ diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/internal.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/internal.ts new file mode 100644 index 00000000000..6691fb86ceb --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/internal.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * Person represents a person + */ +export interface Person { + "Name": string; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/models.ts index ddba4f7ab58..b27d0d189cc 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/models.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/models.ts @@ -1,10 +1,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT - -/** - * Person represents a person - */ -export interface Person { - "Name": string; -} +export type { + Person +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/greetservice.ts new file mode 100644 index 00000000000..2603bdcdecb --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/greetservice.ts @@ -0,0 +1,23 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Call as $Call} from "/wails/runtime.js"; + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import * as $models from "./internal.js"; + +/** + * Make a cycle. + */ +export function MakeCycles(): Promise<[$models.StructA, $models.StructC]> & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.MakeCycles") as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/index.ts new file mode 100644 index 00000000000..8e624c8260f --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/internal.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/internal.ts new file mode 100644 index 00000000000..256987ac8a1 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/internal.ts @@ -0,0 +1,21 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +export interface StructA { + "B": structB | null; +} + +export interface StructC { + "D": structD; +} + +export interface StructE { +} + +export interface structB { + "A": StructA | null; +} + +export interface structD { + "E": StructE; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/models.ts new file mode 100644 index 00000000000..cae6922a9de --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_imports/models.ts @@ -0,0 +1,8 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +export type { + StructA, + StructC, + StructE +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/greetservice.ts similarity index 94% rename from v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/greetservice.ts rename to v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/greetservice.ts index 8585c78d769..98aff5a4a4d 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/greetservice.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/greetservice.ts @@ -12,7 +12,7 @@ import {Call as $Call} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Make a cycle. diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/index.ts new file mode 100644 index 00000000000..8e624c8260f --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/internal.ts similarity index 99% rename from v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/models.ts rename to v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/internal.ts index f2b4b583d73..b378c355031 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/models.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/internal.ts @@ -1,7 +1,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT - export type Alias = Cyclic | null; export type Cyclic = ({ [_: string]: Alias } | null)[] | null; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/models.ts new file mode 100644 index 00000000000..e4c8045036d --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cyclic_types/models.ts @@ -0,0 +1,8 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +export type { + Alias, + Cyclic, + GenericCyclic +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/greetservice.ts index 4294d1e30c3..13a989ddb02 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/greetservice.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/greetservice.ts @@ -12,7 +12,7 @@ import {Call as $Call} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Greet does XYZ diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/internal.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/internal.ts new file mode 100644 index 00000000000..7ac95c04692 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/internal.ts @@ -0,0 +1,29 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * Person represents a person + */ +export interface Person { + "Title": Title; + "Name": string; +} + +/** + * Title is a title + */ +export enum Title { + /** + * The Go zero value for the underlying type of the enum. + */ + $zero = "", + + /** + * Mister is a title + */ + Mister = "Mr", + Miss = "Miss", + Ms = "Ms", + Mrs = "Mrs", + Dr = "Dr", +}; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/models.ts index 1dc9b1859a0..224a055957d 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/models.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/models.ts @@ -1,30 +1,10 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT +export { + Title +} from "./internal.js"; -/** - * Person represents a person - */ -export interface Person { - "Title": Title; - "Name": string; -} - -/** - * Title is a title - */ -export enum Title { - /** - * The Go zero value for the underlying type of the enum. - */ - $zero = "", - - /** - * Mister is a title - */ - Mister = "Mr", - Miss = "Miss", - Ms = "Ms", - Mrs = "Mrs", - Dr = "Dr", -}; +export type { + Person +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/internal.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/internal.ts new file mode 100644 index 00000000000..887aee9ba63 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/internal.ts @@ -0,0 +1,18 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +export enum Title { + /** + * The Go zero value for the underlying type of the enum. + */ + $zero = "", + + /** + * Mister is a title + */ + Mister = "Mr", + Miss = "Miss", + Ms = "Ms", + Mrs = "Mrs", + Dr = "Dr", +}; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/models.ts index ad6a1e62d5b..e8981fc5e89 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/models.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/models.ts @@ -1,19 +1,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT - -export enum Title { - /** - * The Go zero value for the underlying type of the enum. - */ - $zero = "", - - /** - * Mister is a title - */ - Mister = "Mr", - Miss = "Miss", - Ms = "Ms", - Mrs = "Mrs", - Dr = "Dr", -}; +export { + Title +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/greetservice.ts index 4602f3a694f..fa882c8ed1a 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/greetservice.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/greetservice.ts @@ -12,7 +12,7 @@ import {Call as $Call} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Greet does XYZ diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/internal.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/internal.ts new file mode 100644 index 00000000000..99b989f076b --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/internal.ts @@ -0,0 +1,14 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import * as services$0 from "./services/models.js"; + +/** + * Person is a person + */ +export interface Person { + "Name": string; + "Address": services$0.Address | null; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/models.ts index 2027326ed3f..b27d0d189cc 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/models.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/models.ts @@ -1,15 +1,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as services$0 from "./services/models.js"; - -/** - * Person is a person - */ -export interface Person { - "Name": string; - "Address": services$0.Address | null; -} +export type { + Person +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/internal.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/internal.ts new file mode 100644 index 00000000000..b76080cf398 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/internal.ts @@ -0,0 +1,8 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +export interface Address { + "Street": string; + "State": string; + "Country": string; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/models.ts index 964e2d6c722..da9b10c49bc 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/models.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/models.ts @@ -1,9 +1,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT - -export interface Address { - "Street": string; - "State": string; - "Country": string; -} +export type { + Address +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/otherservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/otherservice.ts index 0ea61fe3a07..446d288c620 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/otherservice.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/otherservice.ts @@ -13,7 +13,7 @@ import {Call as $Call} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Yay does this and that diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/greetservice.ts index 4602f3a694f..fa882c8ed1a 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/greetservice.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/greetservice.ts @@ -12,7 +12,7 @@ import {Call as $Call} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Greet does XYZ diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/internal.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/internal.ts new file mode 100644 index 00000000000..70b85519b94 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/internal.ts @@ -0,0 +1,11 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import * as other$0 from "./services/other/models.js"; + +export interface Person { + "Name": string; + "Address": other$0.Address | null; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/models.ts index d506fb70b68..b27d0d189cc 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/models.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/models.ts @@ -1,12 +1,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as other$0 from "./services/other/models.js"; - -export interface Person { - "Name": string; - "Address": other$0.Address | null; -} +export type { + Person +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/internal.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/internal.ts new file mode 100644 index 00000000000..b76080cf398 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/internal.ts @@ -0,0 +1,8 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +export interface Address { + "Street": string; + "State": string; + "Country": string; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/models.ts index 964e2d6c722..da9b10c49bc 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/models.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/models.ts @@ -1,9 +1,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT - -export interface Address { - "Street": string; - "State": string; - "Country": string; -} +export type { + Address +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/otherservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/otherservice.ts index 1bf854765ad..45712d3816f 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/otherservice.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/otherservice.ts @@ -13,7 +13,7 @@ import {Call as $Call} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Yay does this and that diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_internal/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_internal/greetservice.ts new file mode 100644 index 00000000000..f817be3c786 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_internal/greetservice.ts @@ -0,0 +1,19 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Call as $Call} from "/wails/runtime.js"; + +/** + * Greet someone + */ +export function Greet(name: string): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Greet", name) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_internal/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_internal/index.ts new file mode 100644 index 00000000000..50e3f043598 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_internal/index.ts @@ -0,0 +1,7 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/internal.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/internal.ts index 3be70d0b37b..35a843ab0bb 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/internal.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/internal.ts @@ -1,6 +1,40 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import * as other$0 from "./other/models.js"; + +/** + * HowDifferent is a curious kind of person + * that lets other people decide how they are different. + */ +export type HowDifferent = other$0.OtherPerson<{ [_: string]: How | null } | null>; + +/** + * Impersonator gets their fields from other people. + */ +export type Impersonator = other$0.OtherPerson; + +/** + * Person is not a number. + */ +export interface Person { + /** + * They have a name. + */ + "Name": string; + + /** + * Exactly 4 sketchy friends. + */ + "Friends": Impersonator[]; +} + +/** + * PrivatePerson gets their fields from hidden sources. + */ +export type PrivatePerson = personImpl; export interface personImpl { /** @@ -12,4 +46,9 @@ export interface personImpl { * They have a name. */ "Name": string; + + /** + * Exactly 4 sketchy friends. + */ + "Friends": Impersonator[]; } diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/models.ts index 1ff76816d6b..9e517b64401 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/models.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/models.ts @@ -1,37 +1,9 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as other$0 from "./other/models.js"; - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as $internal from "./internal.js"; - -/** - * HowDifferent is a curious kind of person - * that lets other people decide how they are different. - */ -export type HowDifferent = other$0.OtherPerson<{ [_: string]: How | null } | null>; - -/** - * Impersonator gets their fields from other people. - */ -export type Impersonator = other$0.OtherPerson; - -/** - * Person is not a number. - */ -export interface Person { - /** - * They have a name. - */ - "Name": string; -} - -/** - * PrivatePerson gets their fields from hidden sources. - */ -export type PrivatePerson = $internal.personImpl; +export type { + HowDifferent, + Impersonator, + Person, + PrivatePerson +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/internal.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/internal.ts new file mode 100644 index 00000000000..756721e0f10 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/internal.ts @@ -0,0 +1,17 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * OtherPerson is like a person, but different. + */ +export interface OtherPerson { + /** + * They have a name as well. + */ + "Name": string; + + /** + * But they may have many differences. + */ + "Differences": (T | null)[] | null; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/models.ts index c7286bd9e61..596daa5b585 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/models.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/models.ts @@ -1,18 +1,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT - -/** - * OtherPerson is like a person, but different. - */ -export interface OtherPerson { - /** - * They have a name as well. - */ - "Name": string; - - /** - * But they may have many differences. - */ - "Differences": (T | null)[] | null; -} +export type { + OtherPerson +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/somemethods.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/somemethods.ts index 673e516aed5..06e5eeb15fb 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/somemethods.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/somemethods.ts @@ -12,12 +12,12 @@ import {Call as $Call} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * LikeThisOne is an example method that does nothing. */ -export function LikeThisOne(): Promise<[$models.Person, $models.Impersonator, $models.HowDifferent, $models.PrivatePerson]> & { cancel(): void } { +export function LikeThisOne(): Promise<[$models.Person, $models.HowDifferent, $models.PrivatePerson]> & { cancel(): void } { let $resultPromise = $Call.ByName("github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here.SomeMethods.LikeThisOne") as any; return $resultPromise; } diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/embedservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/embedservice.ts index 018792326a3..3674555d37a 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/embedservice.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/embedservice.ts @@ -17,7 +17,7 @@ import * as nobindingshere$0 from "../no_bindings_here/models.js"; /** * LikeThisOne is an example method that does nothing. */ -export function LikeThisOne(): Promise<[nobindingshere$0.Person, nobindingshere$0.Impersonator, nobindingshere$0.HowDifferent, nobindingshere$0.PrivatePerson]> & { cancel(): void } { +export function LikeThisOne(): Promise<[nobindingshere$0.Person, nobindingshere$0.HowDifferent, nobindingshere$0.PrivatePerson]> & { cancel(): void } { let $resultPromise = $Call.ByName("main.EmbedService.LikeThisOne") as any; return $resultPromise; } diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/greetservice.ts index 4602f3a694f..fa882c8ed1a 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/greetservice.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/greetservice.ts @@ -12,7 +12,7 @@ import {Call as $Call} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Greet does XYZ diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/internal.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/internal.ts new file mode 100644 index 00000000000..3ab21d612ed --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/internal.ts @@ -0,0 +1,11 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import * as services$0 from "./services/models.js"; + +export interface Person { + "Name": string; + "Address": services$0.Address | null; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/models.ts index b09de778353..b27d0d189cc 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/models.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/models.ts @@ -1,12 +1,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as services$0 from "./services/models.js"; - -export interface Person { - "Name": string; - "Address": services$0.Address | null; -} +export type { + Person +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/internal.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/internal.ts new file mode 100644 index 00000000000..b76080cf398 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/internal.ts @@ -0,0 +1,8 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +export interface Address { + "Street": string; + "State": string; + "Country": string; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/models.ts index 964e2d6c722..da9b10c49bc 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/models.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/models.ts @@ -1,9 +1,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT - -export interface Address { - "Street": string; - "State": string; - "Country": string; -} +export type { + Address +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/otherservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/otherservice.ts index 6e0546e29c7..d35147b8afc 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/otherservice.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/otherservice.ts @@ -13,7 +13,7 @@ import {Call as $Call} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Yay does this and that diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/greetservice.ts index ee2bed69a54..4f4a45697f5 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/greetservice.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/greetservice.ts @@ -12,7 +12,7 @@ import {Call as $Call} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; export function ArrayInt($in: number[]): Promise & { cancel(): void } { let $resultPromise = $Call.ByName("main.GreetService.ArrayInt", $in) as any; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/internal.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/internal.ts new file mode 100644 index 00000000000..5664b79abdf --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/internal.ts @@ -0,0 +1,8 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +export interface Person { + "Name": string; + "Parent": Person | null; + "Details": {"Age": number, "Address": {"Street": string}}; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/models.ts index 9b48e7941d5..b27d0d189cc 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/models.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/models.ts @@ -1,9 +1,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT - -export interface Person { - "Name": string; - "Parent": Person | null; - "Details": {"Age": number, "Address": {"Street": string}}; -} +export type { + Person +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/greetservice.ts index ee2bed69a54..4f4a45697f5 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/greetservice.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/greetservice.ts @@ -12,7 +12,7 @@ import {Call as $Call} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; export function ArrayInt($in: number[]): Promise & { cancel(): void } { let $resultPromise = $Call.ByName("main.GreetService.ArrayInt", $in) as any; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/internal.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/internal.ts new file mode 100644 index 00000000000..5664b79abdf --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/internal.ts @@ -0,0 +1,8 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +export interface Person { + "Name": string; + "Parent": Person | null; + "Details": {"Age": number, "Address": {"Street": string}}; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/models.ts index 9b48e7941d5..b27d0d189cc 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/models.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/models.ts @@ -1,9 +1,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT - -export interface Person { - "Name": string; - "Parent": Person | null; - "Details": {"Age": number, "Address": {"Street": string}}; -} +export type { + Person +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/greetservice.ts index 4602f3a694f..fa882c8ed1a 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/greetservice.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/greetservice.ts @@ -12,7 +12,7 @@ import {Call as $Call} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Greet does XYZ diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/internal.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/internal.ts new file mode 100644 index 00000000000..f2911720356 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/internal.ts @@ -0,0 +1,15 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import * as services$0 from "./services/models.js"; + +/** + * Person is a person! + * They have a name and an address + */ +export interface Person { + "Name": string; + "Address": services$0.Address | null; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/models.ts index cd4ae5e82e1..b27d0d189cc 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/models.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/models.ts @@ -1,16 +1,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as services$0 from "./services/models.js"; - -/** - * Person is a person! - * They have a name and an address - */ -export interface Person { - "Name": string; - "Address": services$0.Address | null; -} +export type { + Person +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/internal.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/internal.ts new file mode 100644 index 00000000000..b76080cf398 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/internal.ts @@ -0,0 +1,8 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +export interface Address { + "Street": string; + "State": string; + "Country": string; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/models.ts index 964e2d6c722..da9b10c49bc 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/models.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/models.ts @@ -1,9 +1,6 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT - -export interface Address { - "Street": string; - "State": string; - "Country": string; -} +export type { + Address +} from "./internal.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/otherservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/otherservice.ts index 6af5a977a6b..9ea33e12ef1 100644 --- a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/otherservice.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/otherservice.ts @@ -13,7 +13,7 @@ import {Call as $Call} from "/wails/runtime.js"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports -import * as $models from "./models.js"; +import * as $models from "./internal.js"; /** * Yay does this and that diff --git a/v3/internal/generator/testdata/package.json b/v3/internal/generator/testdata/package.json index f8a4cee9e4a..4ad95cc640a 100644 --- a/v3/internal/generator/testdata/package.json +++ b/v3/internal/generator/testdata/package.json @@ -4,6 +4,7 @@ "description": "Output from generator testcases. This package.json is here only to pull in the Typescript compiler as a dependency.", "type": "module", "devDependencies": { - "typescript": "^5.4.5" + "typescript": "^5.7.3", + "madge": "^8.0.0" } } diff --git a/v3/internal/generator/typedefs.go b/v3/internal/generator/typedefs.go new file mode 100644 index 00000000000..de75b6cf4f1 --- /dev/null +++ b/v3/internal/generator/typedefs.go @@ -0,0 +1,34 @@ +package generator + +import ( + "path/filepath" + + "github.com/wailsapp/wails/v3/internal/generator/collect" +) + +// generateTypedefs generates a JS/TS typedef file for the given list of models. +// A call to info.Collect must complete before entering generateTypedefs. +func (generator *Generator) generateTypedefs(info *collect.PackageInfo, models []*collect.ModelInfo) { + // Merge all import maps. + imports := collect.NewImportMap(info) + for _, model := range models { + imports.Merge(model.Imports) + } + + // Clear irrelevant imports. + imports.ImportModels = false + + file, err := generator.creator.Create(filepath.Join(info.Path, generator.renderer.InternalFile())) + if err != nil { + generator.logger.Errorf("%v", err) + generator.logger.Errorf("package %s: models generation failed", info.Path) + return + } + defer file.Close() + + err = generator.renderer.Typedefs(file, imports, models) + if err != nil { + generator.logger.Errorf("%v", err) + generator.logger.Errorf("package %s: models generation failed", info.Path) + } +} diff --git a/v3/pkg/application/application_options.go b/v3/pkg/application/application_options.go index 57643bb0277..2f52996ed25 100644 --- a/v3/pkg/application/application_options.go +++ b/v3/pkg/application/application_options.go @@ -119,11 +119,6 @@ type Options struct { // SingleInstance options for single instance functionality SingleInstance *SingleInstanceOptions - - // This blank field ensures types from other packages - // are never convertible to Options. - // This property, in turn, improves the accuracy of the binding generator. - _ struct{} } // AssetOptions defines the configuration of the AssetServer.