From 7cc0b664b205d4fa4984100452b980c6ddee811a Mon Sep 17 00:00:00 2001 From: Fabio Massaioli Date: Mon, 6 Jan 2025 20:53:24 +0100 Subject: [PATCH 01/21] Add some clarifying comments --- v3/internal/generator/render/create.go | 2 +- v3/internal/generator/render/templates/models.js.tmpl | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/v3/internal/generator/render/create.go b/v3/internal/generator/render/create.go index b7b83383c16..cbe262edd11 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. diff --git a/v3/internal/generator/render/templates/models.js.tmpl b/v3/internal/generator/render/templates/models.js.tmpl index af58096a7f6..8dfe228c219 100644 --- a/v3/internal/generator/render/templates/models.js.tmpl +++ b/v3/internal/generator/render/templates/models.js.tmpl @@ -18,6 +18,11 @@ import {Create as $Create} from "{{js $runtime}}"; import * as {{jsimport .}} from "{{js .RelPath}}/{{js $models}}"; {{- end}}{{if $imports.External}} {{end}} +{{- /* + In interface-only mode, this file is likely to contain just comments. + We then force the inclusion of at least one import statement + to ensure it is recognised as an ES module. +*/}} {{- if or $useInterfaces $imports.ImportModels}} // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: Unused imports From 0e4a05233d1baa125eac8be7b1ba20f3ef317fe6 Mon Sep 17 00:00:00 2001 From: Fabio Massaioli Date: Thu, 9 Jan 2025 16:49:43 +0100 Subject: [PATCH 02/21] Remove special handling of window parameters --- v3/internal/generator/collect/service.go | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/v3/internal/generator/collect/service.go b/v3/internal/generator/collect/service.go index a811e10f22f..5c994ffaf65 100644 --- a/v3/internal/generator/collect/service.go +++ b/v3/internal/generator/collect/service.go @@ -258,8 +258,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 +266,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 } } From 6e04897271b172fd95801947eab045088a128d04 Mon Sep 17 00:00:00 2001 From: Fabio Massaioli Date: Thu, 9 Jan 2025 16:55:25 +0100 Subject: [PATCH 03/21] Improve internal method exclusion --- v3/internal/generator/collect/service.go | 35 ++++++++---------------- 1 file changed, 12 insertions(+), 23 deletions(-) diff --git a/v3/internal/generator/collect/service.go b/v3/internal/generator/collect/service.go index 5c994ffaf65..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) From f5f06c16fb783af85373f3c63d295c7ca5cf1f27 Mon Sep 17 00:00:00 2001 From: Fabio Massaioli Date: Wed, 15 Jan 2025 23:06:32 +0100 Subject: [PATCH 04/21] Add test for internal method exclusion --- .../function_single_internal/bound_types.json | 3 + .../function_single_internal/main.go | 61 +++++++++++++++++++ 2 files changed, 64 insertions(+) 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 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) + } + +} From 5d3dc0e24cf665500c0b4bf60e2e684f7cccfaaf Mon Sep 17 00:00:00 2001 From: Fabio Massaioli Date: Wed, 15 Jan 2025 09:31:02 +0100 Subject: [PATCH 05/21] 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. --- v3/pkg/application/application_options.go | 5 ----- 1 file changed, 5 deletions(-) diff --git a/v3/pkg/application/application_options.go b/v3/pkg/application/application_options.go index 25328c9c6f5..1c5358608d0 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. From d25886d0e02721a0d72790963c942a3df9c912f6 Mon Sep 17 00:00:00 2001 From: Fabio Massaioli Date: Wed, 15 Jan 2025 09:36:02 +0100 Subject: [PATCH 06/21] Remove redundant godebug setting gotypesalias=1 is the default starting with go1.23 --- v3/internal/generator/generate.go | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/v3/internal/generator/generate.go b/v3/internal/generator/generate.go index 44efe3d6da4..39d7e8dc6c6 100644 --- a/v3/internal/generator/generate.go +++ b/v3/internal/generator/generate.go @@ -4,8 +4,6 @@ import ( "fmt" "go/types" "io" - "os" - "slices" "strings" "sync" "time" @@ -80,16 +78,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 { From 804406a6abcf19fc2ae13d4c31241fc5fd4e8ad4 Mon Sep 17 00:00:00 2001 From: Fabio Massaioli Date: Wed, 15 Jan 2025 09:59:39 +0100 Subject: [PATCH 07/21] Use new range for syntax to simplify code --- v3/internal/generator/analyse.go | 119 +++++++++++++------------ v3/internal/generator/analyse_test.go | 9 +- v3/internal/generator/collect/index.go | 10 +-- v3/internal/generator/generate.go | 37 ++++---- 4 files changed, 87 insertions(+), 88 deletions(-) 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/index.go b/v3/internal/generator/collect/index.go index 05c65c1502f..39d470fefd3 100644 --- a/v3/internal/generator/collect/index.go +++ b/v3/internal/generator/collect/index.go @@ -38,7 +38,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 +49,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,7 +60,7 @@ 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) // Update model stats. @@ -70,8 +69,7 @@ func (info *PackageInfo) Index(TS bool) (index *PackageIndex) { } else { stats.NumModels++ } - return true - }) + } // Sort models by internal property (non-internal first), then by name. slices.SortFunc(index.Models, func(m1 *ModelInfo, m2 *ModelInfo) int { diff --git a/v3/internal/generator/generate.go b/v3/internal/generator/generate.go index 39d7e8dc6c6..30b7bc05af8 100644 --- a/v3/internal/generator/generate.go +++ b/v3/internal/generator/generate.go @@ -2,7 +2,6 @@ package generator import ( "fmt" - "go/types" "io" "strings" "sync" @@ -141,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 @@ -174,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() { From c49e103d664c96e3f95cabb277b343ebd337e0e5 Mon Sep 17 00:00:00 2001 From: Fabio Massaioli Date: Wed, 15 Jan 2025 09:59:59 +0100 Subject: [PATCH 08/21] Remove generator dependency on github.com/samber/lo --- v3/internal/generator/errors.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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. From 32007139a82233305857b35bda2f5f64661a09d8 Mon Sep 17 00:00:00 2001 From: Fabio Massaioli Date: Wed, 15 Jan 2025 22:38:42 +0100 Subject: [PATCH 09/21] Ensure generator testing tasks do not use the test cache --- v3/internal/generator/Taskfile.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/v3/internal/generator/Taskfile.yaml b/v3/internal/generator/Taskfile.yaml index c4950ec50e5..1737aec2bd2 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 From a6f318f78fa3a6b5c33825beedd6f55b17b810bf Mon Sep 17 00:00:00 2001 From: Fabio Massaioli Date: Wed, 15 Jan 2025 22:39:17 +0100 Subject: [PATCH 10/21] Rename cyclic types test --- .../generator/testcases/{cycles => cyclic_types}/bound_types.json | 0 v3/internal/generator/testcases/{cycles => cyclic_types}/main.go | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename v3/internal/generator/testcases/{cycles => cyclic_types}/bound_types.json (100%) rename v3/internal/generator/testcases/{cycles => cyclic_types}/main.go (100%) diff --git a/v3/internal/generator/testcases/cycles/bound_types.json b/v3/internal/generator/testcases/cyclic_types/bound_types.json similarity index 100% rename from v3/internal/generator/testcases/cycles/bound_types.json rename to v3/internal/generator/testcases/cyclic_types/bound_types.json 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 From 215d8618b88249b31c6f4e0bbb8b8dea5819b016 Mon Sep 17 00:00:00 2001 From: Fabio Massaioli Date: Wed, 15 Jan 2025 22:40:42 +0100 Subject: [PATCH 11/21] Test for cyclic imports --- v3/internal/generator/Taskfile.yaml | 1 + .../testcases/cyclic_imports/bound_types.json | 3 + .../testcases/cyclic_imports/main.go | 55 +++++++++++++++++++ v3/internal/generator/testdata/package.json | 3 +- 4 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 v3/internal/generator/testcases/cyclic_imports/bound_types.json create mode 100644 v3/internal/generator/testcases/cyclic_imports/main.go diff --git a/v3/internal/generator/Taskfile.yaml b/v3/internal/generator/Taskfile.yaml index 1737aec2bd2..f9e66e9396a 100644 --- a/v3/internal/generator/Taskfile.yaml +++ b/v3/internal/generator/Taskfile.yaml @@ -40,6 +40,7 @@ tasks: - install-deps cmds: - npx tsc + - npx madge --circular output/ install-deps: internal: true diff --git a/v3/internal/generator/testcases/cyclic_imports/bound_types.json b/v3/internal/generator/testcases/cyclic_imports/bound_types.json new file mode 100644 index 00000000000..a8b95e32197 --- /dev/null +++ b/v3/internal/generator/testcases/cyclic_imports/bound_types.json @@ -0,0 +1,3 @@ +[ + ".GreetService" +] 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/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" } } From 720661ef45adfc662cc8126e6789a3b56dcd4f0f Mon Sep 17 00:00:00 2001 From: Fabio Massaioli Date: Sat, 11 Jan 2025 00:39:38 +0100 Subject: [PATCH 12/21] Fix import cycle between model files --- v3/internal/generator/collect/imports.go | 12 +-- v3/internal/generator/collect/index.go | 39 ++++---- v3/internal/generator/generate.go | 6 +- v3/internal/generator/includes.go | 4 +- v3/internal/generator/models.go | 48 ++-------- v3/internal/generator/render/create.go | 4 +- v3/internal/generator/render/default.go | 4 +- v3/internal/generator/render/renderer.go | 27 ++++-- v3/internal/generator/render/templates.go | 8 +- .../generator/render/templates/index.tmpl | 2 +- .../{models.js.tmpl => internal.js.tmpl} | 23 ++--- .../{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 | 4 +- v3/internal/generator/typedefs.go | 34 +++++++ 17 files changed, 196 insertions(+), 140 deletions(-) rename v3/internal/generator/render/templates/{models.js.tmpl => internal.js.tmpl} (92%) rename v3/internal/generator/render/templates/{models.ts.tmpl => internal.ts.tmpl} (93%) create mode 100644 v3/internal/generator/render/templates/models.tmpl create mode 100644 v3/internal/generator/typedefs.go 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 39d470fefd3..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. @@ -63,6 +69,10 @@ func (info *PackageInfo) Index(TS bool) (index *PackageIndex) { 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++ @@ -71,7 +81,7 @@ func (info *PackageInfo) Index(TS bool) (index *PackageIndex) { } } - // 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 @@ -89,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/generate.go b/v3/internal/generator/generate.go index 30b7bc05af8..7a8c38cf21c 100644 --- a/v3/internal/generator/generate.go +++ b/v3/internal/generator/generate.go @@ -209,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 cbe262edd11..9ab8098696a 100644 --- a/v3/internal/generator/render/create.go +++ b/v3/internal/generator/render/create.go @@ -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..5b7e8047a9d 100644 --- a/v3/internal/generator/render/default.go +++ b/v3/internal/generator/render/default.go @@ -105,10 +105,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..a4ae4aca3a8 100644 --- a/v3/internal/generator/render/renderer.go +++ b/v3/internal/generator/render/renderer.go @@ -17,8 +17,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 +35,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 +79,9 @@ 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 { + return renderer.typedefs.Execute(w, &struct { module Models []*collect.ModelInfo }{ @@ -94,6 +94,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 92% rename from v3/internal/generator/render/templates/models.js.tmpl rename to v3/internal/generator/render/templates/internal.js.tmpl index 8dfe228c219..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,28 +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}} -{{- /* - In interface-only mode, this file is likely to contain just comments. - We then force the inclusion of at least one import statement - to ensure it is recognised as an ES module. -*/}} -{{- 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}} @@ -223,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..142f997bb44 100644 --- a/v3/internal/generator/render/type.go +++ b/v3/internal/generator/render/type.go @@ -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/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) + } +} From 5fcce727387eb96354e0453e83c53af9595416b2 Mon Sep 17 00:00:00 2001 From: Fabio Massaioli Date: Sat, 11 Jan 2025 09:10:27 +0100 Subject: [PATCH 13/21] Sort class aliases after their aliased class --- v3/internal/generator/collect/properties.go | 4 +- v3/internal/generator/render/renderer.go | 41 +++++++++++++++++++++ 2 files changed, 43 insertions(+), 2 deletions(-) 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/render/renderer.go b/v3/internal/generator/render/renderer.go index a4ae4aca3a8..5cf7e5d6bd3 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" @@ -81,6 +83,45 @@ func (renderer *Renderer) Service(w io.Writer, info *collect.ServiceInfo) error // 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)) + // Placeholder for marking visited objects. + visited := make([]*collect.ModelInfo, 0) + + 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 := aliases[obj]; a == nil || 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()] = visited + j += copy(models[j:], a) + } + } + } + return renderer.typedefs.Execute(w, &struct { module Models []*collect.ModelInfo From cb51682259466b4796219b3fd69e345296f7f22a Mon Sep 17 00:00:00 2001 From: Fabio Massaioli Date: Sat, 11 Jan 2025 09:35:22 +0100 Subject: [PATCH 14/21] Test class aliases --- .../generator/testcases/aliases/main.go | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) 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{} From f94a34a010957897464ec509317c8dfc382b9082 Mon Sep 17 00:00:00 2001 From: Fabio Massaioli Date: Tue, 14 Jan 2025 23:19:52 +0100 Subject: [PATCH 15/21] Fix length of default value for array types --- v3/internal/generator/render/default.go | 10 +++++++++- v3/internal/generator/render/type.go | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/v3/internal/generator/render/default.go b/v3/internal/generator/render/default.go index 5b7e8047a9d..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 { diff --git a/v3/internal/generator/render/type.go b/v3/internal/generator/render/type.go index 142f997bb44..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 != "" } From 6e366edc179e48d220f2c3e196a2fe1dbca81d63 Mon Sep 17 00:00:00 2001 From: Fabio Massaioli Date: Tue, 14 Jan 2025 23:42:36 +0100 Subject: [PATCH 16/21] Test array initialization --- v3/internal/generator/testcases/no_bindings_here/person.go | 3 ++- .../generator/testcases/no_bindings_here/somemethods.go | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) 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 } From 741594939c78e97b16ffc5d33236c73ede7917b2 Mon Sep 17 00:00:00 2001 From: Fabio Massaioli Date: Wed, 15 Jan 2025 22:27:19 +0100 Subject: [PATCH 17/21] Add changelog --- docs/src/content/docs/changelog.mdx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/src/content/docs/changelog.mdx b/docs/src/content/docs/changelog.mdx index b1e0ce13d8b..8d545141d8f 100644 --- a/docs/src/content/docs/changelog.mdx +++ b/docs/src/content/docs/changelog.mdx @@ -26,22 +26,29 @@ 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) - Add `window-call` example to demonstrate how to know which window is calling a service 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) +- Default value for fields of array types of fixed length has now the 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 From 47aa75c62bb110b0abeee60007fe75e8961e7a23 Mon Sep 17 00:00:00 2001 From: Fabio Massaioli Date: Wed, 15 Jan 2025 23:56:22 +0100 Subject: [PATCH 18/21] Update changelog --- docs/src/content/docs/changelog.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/content/docs/changelog.mdx b/docs/src/content/docs/changelog.mdx index 8d545141d8f..bfe4d46e32d 100644 --- a/docs/src/content/docs/changelog.mdx +++ b/docs/src/content/docs/changelog.mdx @@ -48,7 +48,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Removed `application.WindowIDKey` and `application.WindowNameKey` (replaced by `application.WindowKey`) by [@leaanthony](https://github.com/leaanthony) -- Default value for fields of array types of fixed length has now the expected length instead of being empty by [@fbbdev](https://github.com/fbbdev) in [#4001](https://github.com/wailsapp/wails/pull/4001) +- 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 From 5e84f8a48a6d5caf889734110c21fb11530809ca Mon Sep 17 00:00:00 2001 From: Fabio Massaioli Date: Thu, 16 Jan 2025 11:21:48 +0100 Subject: [PATCH 19/21] Fix contrived marking technique in model sorting algorithm --- v3/internal/generator/render/renderer.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/v3/internal/generator/render/renderer.go b/v3/internal/generator/render/renderer.go index 5cf7e5d6bd3..e1108716e66 100644 --- a/v3/internal/generator/render/renderer.go +++ b/v3/internal/generator/render/renderer.go @@ -89,8 +89,6 @@ func (renderer *Renderer) Typedefs(w io.Writer, imports *collect.ImportMap, mode // Track postponed class aliases and their dependencies. aliases := make(map[types.Object][]*collect.ModelInfo, len(models)) - // Placeholder for marking visited objects. - visited := make([]*collect.ModelInfo, 0) models = slices.Clone(models) for i, j := 0, 0; i < len(models); i++ { @@ -101,7 +99,7 @@ func (renderer *Renderer) Typedefs(w io.Writer, imports *collect.ImportMap, mode 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 := aliases[obj]; a == nil || len(a) > 0 { + 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 @@ -116,7 +114,7 @@ func (renderer *Renderer) Typedefs(w io.Writer, imports *collect.ImportMap, mode // 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()] = visited + aliases[models[k].Object()] = nil // Mark aliased model as visited j += copy(models[j:], a) } } From c5e99f5ec6385c8c4af53070f711a2c0f8d6e44d Mon Sep 17 00:00:00 2001 From: Fabio Massaioli Date: Wed, 15 Jan 2025 23:10:12 +0100 Subject: [PATCH 20/21] Update binding example --- .../v3/examples/binding/data/internal.js | 55 +++++++++++++++++++ .../wails/v3/examples/binding/data/models.js | 54 +----------------- 2 files changed, 58 insertions(+), 51 deletions(-) create mode 100644 v3/examples/binding/assets/bindings/github.com/wailsapp/wails/v3/examples/binding/data/internal.js 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"; From ee4ed99c721aa73a5c1cecc477ad1a0be6efe2fd Mon Sep 17 00:00:00 2001 From: Fabio Massaioli Date: Wed, 15 Jan 2025 23:10:25 +0100 Subject: [PATCH 21/21] Update test data --- .../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 + .../testcases/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 + .../testcases/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 +- 480 files changed, 8408 insertions(+), 5620 deletions(-) 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=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/models.js => UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/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=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/models.js => UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/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 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=true/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=true/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=true/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=false/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=false/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=false/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