fix(v3/generator): binding generation for cross-package type aliases (#4948)

* Add test case for aliases of imported types

* Replace `typeutil.Map` with object-keyed map in `addTypeImpl` method

* Replace `typeutil.Map` with object-keyed map in `needsCreateImpl` method

* Update UNRELEASED_CHANGELOG.md

* Update binding generator test data

---------

Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
This commit is contained in:
Fabio Massaioli 2026-02-03 21:05:04 +01:00 committed by GitHub
commit 801acd01df
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
45 changed files with 548 additions and 44 deletions

View file

@ -23,6 +23,7 @@ After processing, the content will be moved to the main changelog and this file
## Fixed
<!-- Bug fixes -->
- Fix binding generation for cross-package type aliases (#4578) by @fbbdev
## Deprecated
<!-- Soon-to-be removed features -->

View file

@ -3,8 +3,6 @@ package collect
import (
"go/types"
"path/filepath"
"golang.org/x/tools/go/types/typeutil"
)
type (
@ -122,12 +120,12 @@ func (imports *ImportMap) Add(pkg *PackageInfo) {
// AddType does not support unsynchronised concurrent calls
// on the same receiver.
func (imports *ImportMap) AddType(typ types.Type) {
imports.addTypeImpl(typ, new(typeutil.Map))
imports.addTypeImpl(typ, make(map[*types.TypeName]bool))
}
// addTypeImpl provides the actual implementation of AddType.
// The visited parameter is used to break cycles.
func (imports *ImportMap) addTypeImpl(typ types.Type, visited *typeutil.Map) {
func (imports *ImportMap) addTypeImpl(typ types.Type, visited map[*types.TypeName]bool) {
collector := imports.collector
if collector == nil {
panic("AddType called on ImportMap with nil collector")
@ -136,17 +134,18 @@ func (imports *ImportMap) addTypeImpl(typ types.Type, visited *typeutil.Map) {
for { // Avoid recursion where possible.
switch t := typ.(type) {
case *types.Alias, *types.Named:
if visited.Set(typ, true) != nil {
// Break type cycles.
return
}
obj := typ.(interface{ Obj() *types.TypeName }).Obj()
if obj.Pkg() == nil {
// Ignore universe type.
return
}
if visited[obj] {
// Break type cycles.
return
}
visited[obj] = true
// Special case: application.Void will render as TS void hence no dependencies and no model
if collector.IsVoidAlias(obj) {
return

View file

@ -7,7 +7,6 @@ import (
"text/template"
"github.com/wailsapp/wails/v3/internal/generator/collect"
"golang.org/x/tools/go/types/typeutil"
)
// SkipCreate returns true if the given array of types needs no creation code.
@ -22,12 +21,12 @@ func (m *module) SkipCreate(ts []types.Type) bool {
// NeedsCreate returns true if the given type needs some creation code.
func (m *module) NeedsCreate(typ types.Type) bool {
return m.needsCreateImpl(typ, new(typeutil.Map))
return m.needsCreateImpl(typ, make(map[*types.TypeName]bool))
}
// needsCreateImpl provides the actual implementation of NeedsCreate.
// The visited parameter is used to break cycles.
func (m *module) needsCreateImpl(typ types.Type, visited *typeutil.Map) bool {
func (m *module) needsCreateImpl(typ types.Type, visited map[*types.TypeName]bool) bool {
switch t := typ.(type) {
case *types.Alias:
if m.collector.IsVoidAlias(t.Obj()) {
@ -37,20 +36,22 @@ func (m *module) needsCreateImpl(typ types.Type, visited *typeutil.Map) bool {
return m.needsCreateImpl(types.Unalias(typ), visited)
case *types.Named:
if visited.Set(typ, true) != nil {
obj := t.Obj()
if visited[obj] {
// The only way to hit a cycle here
// is through a chain of structs, nested pointers and arrays (not slices).
// We can safely return false at this point
// as the final answer is independent of the cycle.
// since the cycle will not contribute to the final answer.
return false
}
visited[obj] = true
if t.Obj().Pkg() == nil {
if obj.Pkg() == nil {
// Builtin named type: render underlying type.
return m.needsCreateImpl(t.Underlying(), visited)
}
if m.collector.IsVoidAlias(t.Obj()) {
if m.collector.IsVoidAlias(obj) {
return false
}

View file

@ -5,6 +5,7 @@ import (
"encoding"
"log"
"github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/subpkg"
nobindingshere "github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here"
"github.com/wailsapp/wails/v3/pkg/application"
)
@ -75,6 +76,9 @@ type IndirectPersonAlias = GenericPersonAlias[bool]
// An alias that wraps a class through a typeparam alias.
type TPIndirectPersonAlias = GenericAlias[GenericPerson[bool]]
// An alias referencing another package that is not used elsewhere.
type SubPackageAlias = subpkg.SubStruct
// A class whose fields have various aliased types.
type AliasGroup struct {
GAi GenericAlias[int]
@ -85,6 +89,7 @@ type AliasGroup struct {
GPA GenericPersonAlias[bool]
IPA IndirectPersonAlias
TPIPA TPIndirectPersonAlias
SPA SubPackageAlias
}
// Get someone.
@ -106,6 +111,10 @@ func (GreetService) GetButForeignPrivateAlias() (_ nobindingshere.PrivatePerson)
return
}
func (GreetService) GetButSubPackageAlias() (_ SubPackageAlias) {
return
}
func (GreetService) GetButGenericAliases() (_ AliasGroup) {
return
}

View file

@ -0,0 +1,6 @@
package subpkg
// SubStruct is a type in a subpackage that is only referenced through an alias.
type SubStruct struct {
SomeField []string
}

View file

@ -11,6 +11,9 @@
// @ts-ignore: Unused imports
import { Call as $Call, CancellablePromise as $CancellablePromise, Create as $Create } from "/wails/runtime.js";
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore: Unused imports
import * as subpkg$0 from "./subpkg/models.js";
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore: Unused imports
import * as nobindingshere$0 from "../no_bindings_here/models.js";
@ -69,6 +72,15 @@ export function GetButGenericAliases() {
}));
}
/**
* @returns {$CancellablePromise<$models.SubPackageAlias>}
*/
export function GetButSubPackageAlias() {
return $Call.ByID(1443276371).then(/** @type {($result: any) => any} */(($result) => {
return $$createType4($result);
}));
}
/**
* Greet a lot of unusual things.
* @param {$models.EmptyAliasStruct} $0
@ -77,7 +89,7 @@ export function GetButGenericAliases() {
*/
export function Greet($0, $1) {
return $Call.ByID(1411160069, $0, $1).then(/** @type {($result: any) => any} */(($result) => {
return $$createType7($result);
return $$createType8($result);
}));
}
@ -86,12 +98,13 @@ const $$createType0 = $models.Person.createFrom;
const $$createType1 = $models.GenericPerson.createFrom($Create.Any);
const $$createType2 = nobindingshere$0.personImpl.createFrom;
const $$createType3 = $models.AliasGroup.createFrom;
const $$createType4 = $Create.Array($Create.Any);
const $$createType4 = subpkg$0.SubStruct.createFrom;
const $$createType5 = $Create.Array($Create.Any);
const $$createType6 = $Create.Struct({
"NoMoreIdeas": $$createType5,
});
const $$createType6 = $Create.Array($Create.Any);
const $$createType7 = $Create.Struct({
"Foo": $$createType4,
"Other": $$createType6,
"NoMoreIdeas": $$createType6,
});
const $$createType8 = $Create.Struct({
"Foo": $$createType5,
"Other": $$createType7,
});

View file

@ -16,6 +16,7 @@ export {
IndirectPersonAlias,
Person,
StrangelyAliasedPerson,
SubPackageAlias,
TPIndirectPersonAlias
} from "./models.js";

View file

@ -6,6 +6,10 @@
// @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 subpkg$0 from "./subpkg/models.js";
/**
* A nice type Alias.
* @typedef {number} Alias
@ -76,6 +80,13 @@ export class AliasGroup {
*/
this["TPIPA"] = (new TPIndirectPersonAlias());
}
if (!("SPA" in $$source)) {
/**
* @member
* @type {SubPackageAlias}
*/
this["SPA"] = (new SubPackageAlias());
}
Object.assign(this, $$source);
}
@ -93,6 +104,7 @@ export class AliasGroup {
const $$createField5_0 = $$createType8;
const $$createField6_0 = $$createType8;
const $$createField7_0 = $$createType0;
const $$createField8_0 = $$createType9;
let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
if ("GAP" in $$parsedSource) {
$$parsedSource["GAP"] = $$createField1_0($$parsedSource["GAP"]);
@ -115,6 +127,9 @@ export class AliasGroup {
if ("TPIPA" in $$parsedSource) {
$$parsedSource["TPIPA"] = $$createField7_0($$parsedSource["TPIPA"]);
}
if ("SPA" in $$parsedSource) {
$$parsedSource["SPA"] = $$createField8_0($$parsedSource["SPA"]);
}
return new AliasGroup(/** @type {Partial<AliasGroup>} */($$parsedSource));
}
}
@ -312,6 +327,16 @@ export const StrangelyAliasedPerson = Person;
* @typedef {Person} StrangelyAliasedPerson
*/
/**
* An alias referencing another package that is not used elsewhere.
*/
export const SubPackageAlias = subpkg$0.SubStruct;
/**
* An alias referencing another package that is not used elsewhere.
* @typedef {subpkg$0.SubStruct} SubPackageAlias
*/
/**
* An alias that wraps a class through a typeparam alias.
*/
@ -332,3 +357,4 @@ const $$createType5 = $Create.Nullable($$createType4);
const $$createType6 = $Create.Map($Create.Any, $Create.Any);
const $$createType7 = $Create.Array($Create.Any);
const $$createType8 = GenericPerson.createFrom($$createType7);
const $$createType9 = subpkg$0.SubStruct.createFrom;

View file

@ -0,0 +1,7 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
export {
SubStruct
} from "./models.js";

View file

@ -0,0 +1,45 @@
// @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";
/**
* SubStruct is a type in a subpackage that is only referenced through an alias.
*/
export class SubStruct {
/**
* Creates a new SubStruct instance.
* @param {Partial<SubStruct>} [$$source = {}] - The source object to create the SubStruct.
*/
constructor($$source = {}) {
if (!("SomeField" in $$source)) {
/**
* @member
* @type {string[]}
*/
this["SomeField"] = [];
}
Object.assign(this, $$source);
}
/**
* Creates a new SubStruct instance from a string or object.
* @param {any} [$$source = {}]
* @returns {SubStruct}
*/
static createFrom($$source = {}) {
const $$createField0_0 = $$createType0;
let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
if ("SomeField" in $$parsedSource) {
$$parsedSource["SomeField"] = $$createField0_0($$parsedSource["SomeField"]);
}
return new SubStruct(/** @type {Partial<SubStruct>} */($$parsedSource));
}
}
// Private type creation functions
const $$createType0 = $Create.Array($Create.Any);

View file

@ -11,6 +11,9 @@
// @ts-ignore: Unused imports
import { Call as $Call, CancellablePromise as $CancellablePromise, Create as $Create } from "/wails/runtime.js";
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore: Unused imports
import * as subpkg$0 from "./subpkg/models.js";
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore: Unused imports
import * as nobindingshere$0 from "../no_bindings_here/models.js";
@ -69,6 +72,15 @@ export function GetButGenericAliases() {
}));
}
/**
* @returns {$CancellablePromise<$models.SubPackageAlias>}
*/
export function GetButSubPackageAlias() {
return $Call.ByName("main.GreetService.GetButSubPackageAlias").then(/** @type {($result: any) => any} */(($result) => {
return $$createType4($result);
}));
}
/**
* Greet a lot of unusual things.
* @param {$models.EmptyAliasStruct} $0
@ -77,7 +89,7 @@ export function GetButGenericAliases() {
*/
export function Greet($0, $1) {
return $Call.ByName("main.GreetService.Greet", $0, $1).then(/** @type {($result: any) => any} */(($result) => {
return $$createType7($result);
return $$createType8($result);
}));
}
@ -86,12 +98,13 @@ const $$createType0 = $models.Person.createFrom;
const $$createType1 = $models.GenericPerson.createFrom($Create.Any);
const $$createType2 = nobindingshere$0.personImpl.createFrom;
const $$createType3 = $models.AliasGroup.createFrom;
const $$createType4 = $Create.Array($Create.Any);
const $$createType4 = subpkg$0.SubStruct.createFrom;
const $$createType5 = $Create.Array($Create.Any);
const $$createType6 = $Create.Struct({
"NoMoreIdeas": $$createType5,
});
const $$createType6 = $Create.Array($Create.Any);
const $$createType7 = $Create.Struct({
"Foo": $$createType4,
"Other": $$createType6,
"NoMoreIdeas": $$createType6,
});
const $$createType8 = $Create.Struct({
"Foo": $$createType5,
"Other": $$createType7,
});

View file

@ -16,6 +16,7 @@ export {
IndirectPersonAlias,
Person,
StrangelyAliasedPerson,
SubPackageAlias,
TPIndirectPersonAlias
} from "./models.js";

View file

@ -6,6 +6,10 @@
// @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 subpkg$0 from "./subpkg/models.js";
/**
* A nice type Alias.
* @typedef {number} Alias
@ -76,6 +80,13 @@ export class AliasGroup {
*/
this["TPIPA"] = (new TPIndirectPersonAlias());
}
if (!("SPA" in $$source)) {
/**
* @member
* @type {SubPackageAlias}
*/
this["SPA"] = (new SubPackageAlias());
}
Object.assign(this, $$source);
}
@ -93,6 +104,7 @@ export class AliasGroup {
const $$createField5_0 = $$createType8;
const $$createField6_0 = $$createType8;
const $$createField7_0 = $$createType0;
const $$createField8_0 = $$createType9;
let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
if ("GAP" in $$parsedSource) {
$$parsedSource["GAP"] = $$createField1_0($$parsedSource["GAP"]);
@ -115,6 +127,9 @@ export class AliasGroup {
if ("TPIPA" in $$parsedSource) {
$$parsedSource["TPIPA"] = $$createField7_0($$parsedSource["TPIPA"]);
}
if ("SPA" in $$parsedSource) {
$$parsedSource["SPA"] = $$createField8_0($$parsedSource["SPA"]);
}
return new AliasGroup(/** @type {Partial<AliasGroup>} */($$parsedSource));
}
}
@ -312,6 +327,16 @@ export const StrangelyAliasedPerson = Person;
* @typedef {Person} StrangelyAliasedPerson
*/
/**
* An alias referencing another package that is not used elsewhere.
*/
export const SubPackageAlias = subpkg$0.SubStruct;
/**
* An alias referencing another package that is not used elsewhere.
* @typedef {subpkg$0.SubStruct} SubPackageAlias
*/
/**
* An alias that wraps a class through a typeparam alias.
*/
@ -332,3 +357,4 @@ const $$createType5 = $Create.Nullable($$createType4);
const $$createType6 = $Create.Map($Create.Any, $Create.Any);
const $$createType7 = $Create.Array($Create.Any);
const $$createType8 = GenericPerson.createFrom($$createType7);
const $$createType9 = subpkg$0.SubStruct.createFrom;

View file

@ -0,0 +1,7 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
export {
SubStruct
} from "./models.js";

View file

@ -0,0 +1,45 @@
// @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";
/**
* SubStruct is a type in a subpackage that is only referenced through an alias.
*/
export class SubStruct {
/**
* Creates a new SubStruct instance.
* @param {Partial<SubStruct>} [$$source = {}] - The source object to create the SubStruct.
*/
constructor($$source = {}) {
if (!("SomeField" in $$source)) {
/**
* @member
* @type {string[]}
*/
this["SomeField"] = [];
}
Object.assign(this, $$source);
}
/**
* Creates a new SubStruct instance from a string or object.
* @param {any} [$$source = {}]
* @returns {SubStruct}
*/
static createFrom($$source = {}) {
const $$createField0_0 = $$createType0;
let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
if ("SomeField" in $$parsedSource) {
$$parsedSource["SomeField"] = $$createField0_0($$parsedSource["SomeField"]);
}
return new SubStruct(/** @type {Partial<SubStruct>} */($$parsedSource));
}
}
// Private type creation functions
const $$createType0 = $Create.Array($Create.Any);

View file

@ -59,6 +59,13 @@ export function GetButGenericAliases() {
return $Call.ByID(914093800);
}
/**
* @returns {$CancellablePromise<$models.SubPackageAlias>}
*/
export function GetButSubPackageAlias() {
return $Call.ByID(1443276371);
}
/**
* Greet a lot of unusual things.
* @param {$models.EmptyAliasStruct} $0

View file

@ -90,6 +90,11 @@ import * as $models from "./models.js";
* @typedef {$models.StrangelyAliasedPerson} StrangelyAliasedPerson
*/
/**
* An alias referencing another package that is not used elsewhere.
* @typedef {$models.SubPackageAlias} SubPackageAlias
*/
/**
* An alias that wraps a class through a typeparam alias.
* @typedef {$models.TPIndirectPersonAlias} TPIndirectPersonAlias

View file

@ -2,6 +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 subpkg$0 from "./subpkg/models.js";
/**
* A nice type Alias.
* @typedef {number} Alias
@ -18,6 +22,7 @@
* @property {GenericPersonAlias<boolean>} GPA
* @property {IndirectPersonAlias} IPA
* @property {TPIndirectPersonAlias} TPIPA
* @property {SubPackageAlias} SPA
*/
/**
@ -102,6 +107,11 @@
* @typedef {Person} StrangelyAliasedPerson
*/
/**
* An alias referencing another package that is not used elsewhere.
* @typedef {subpkg$0.SubStruct} SubPackageAlias
*/
/**
* An alias that wraps a class through a typeparam alias.
* @typedef {GenericAlias<GenericPerson<boolean>>} TPIndirectPersonAlias

View file

@ -0,0 +1,10 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
import * as $models from "./models.js";
/**
* SubStruct is a type in a subpackage that is only referenced through an alias.
* @typedef {$models.SubStruct} SubStruct
*/

View file

@ -0,0 +1,13 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
/**
* SubStruct is a type in a subpackage that is only referenced through an alias.
* @typedef {Object} SubStruct
* @property {string[] | null} SomeField
*/
// 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 {};

View file

@ -59,6 +59,13 @@ export function GetButGenericAliases() {
return $Call.ByName("main.GreetService.GetButGenericAliases");
}
/**
* @returns {$CancellablePromise<$models.SubPackageAlias>}
*/
export function GetButSubPackageAlias() {
return $Call.ByName("main.GreetService.GetButSubPackageAlias");
}
/**
* Greet a lot of unusual things.
* @param {$models.EmptyAliasStruct} $0

View file

@ -90,6 +90,11 @@ import * as $models from "./models.js";
* @typedef {$models.StrangelyAliasedPerson} StrangelyAliasedPerson
*/
/**
* An alias referencing another package that is not used elsewhere.
* @typedef {$models.SubPackageAlias} SubPackageAlias
*/
/**
* An alias that wraps a class through a typeparam alias.
* @typedef {$models.TPIndirectPersonAlias} TPIndirectPersonAlias

View file

@ -2,6 +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 subpkg$0 from "./subpkg/models.js";
/**
* A nice type Alias.
* @typedef {number} Alias
@ -18,6 +22,7 @@
* @property {GenericPersonAlias<boolean>} GPA
* @property {IndirectPersonAlias} IPA
* @property {TPIndirectPersonAlias} TPIPA
* @property {SubPackageAlias} SPA
*/
/**
@ -102,6 +107,11 @@
* @typedef {Person} StrangelyAliasedPerson
*/
/**
* An alias referencing another package that is not used elsewhere.
* @typedef {subpkg$0.SubStruct} SubPackageAlias
*/
/**
* An alias that wraps a class through a typeparam alias.
* @typedef {GenericAlias<GenericPerson<boolean>>} TPIndirectPersonAlias

View file

@ -0,0 +1,10 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
import * as $models from "./models.js";
/**
* SubStruct is a type in a subpackage that is only referenced through an alias.
* @typedef {$models.SubStruct} SubStruct
*/

View file

@ -0,0 +1,13 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
/**
* SubStruct is a type in a subpackage that is only referenced through an alias.
* @typedef {Object} SubStruct
* @property {string[] | null} SomeField
*/
// 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 {};

View file

@ -10,6 +10,9 @@
// @ts-ignore: Unused imports
import { Call as $Call, CancellablePromise as $CancellablePromise, Create as $Create } from "/wails/runtime.js";
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore: Unused imports
import * as subpkg$0 from "./subpkg/models.js";
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore: Unused imports
import * as nobindingshere$0 from "../no_bindings_here/models.js";
@ -57,12 +60,18 @@ export function GetButGenericAliases(): $CancellablePromise<$models.AliasGroup>
});
}
export function GetButSubPackageAlias(): $CancellablePromise<$models.SubPackageAlias> {
return $Call.ByID(1443276371).then(($result: any) => {
return $$createType4($result);
});
}
/**
* Greet a lot of unusual things.
*/
export function Greet($0: $models.EmptyAliasStruct, $1: $models.EmptyStruct): $CancellablePromise<$models.AliasStruct> {
return $Call.ByID(1411160069, $0, $1).then(($result: any) => {
return $$createType7($result);
return $$createType8($result);
});
}
@ -71,12 +80,13 @@ const $$createType0 = $models.Person.createFrom;
const $$createType1 = $models.GenericPerson.createFrom($Create.Any);
const $$createType2 = nobindingshere$0.personImpl.createFrom;
const $$createType3 = $models.AliasGroup.createFrom;
const $$createType4 = $Create.Array($Create.Any);
const $$createType4 = subpkg$0.SubStruct.createFrom;
const $$createType5 = $Create.Array($Create.Any);
const $$createType6 = $Create.Struct({
"NoMoreIdeas": $$createType5,
});
const $$createType6 = $Create.Array($Create.Any);
const $$createType7 = $Create.Struct({
"Foo": $$createType4,
"Other": $$createType6,
"NoMoreIdeas": $$createType6,
});
const $$createType8 = $Create.Struct({
"Foo": $$createType5,
"Other": $$createType7,
});

View file

@ -15,6 +15,7 @@ export {
IndirectPersonAlias,
Person,
StrangelyAliasedPerson,
SubPackageAlias,
TPIndirectPersonAlias
} from "./models.js";

View file

@ -5,6 +5,10 @@
// @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 subpkg$0 from "./subpkg/models.js";
/**
* A nice type Alias.
*/
@ -22,6 +26,7 @@ export class AliasGroup {
"GPA": GenericPersonAlias<boolean>;
"IPA": IndirectPersonAlias;
"TPIPA": TPIndirectPersonAlias;
"SPA": SubPackageAlias;
/** Creates a new AliasGroup instance. */
constructor($$source: Partial<AliasGroup> = {}) {
@ -49,6 +54,9 @@ export class AliasGroup {
if (!("TPIPA" in $$source)) {
this["TPIPA"] = (new TPIndirectPersonAlias());
}
if (!("SPA" in $$source)) {
this["SPA"] = (new SubPackageAlias());
}
Object.assign(this, $$source);
}
@ -64,6 +72,7 @@ export class AliasGroup {
const $$createField5_0 = $$createType8;
const $$createField6_0 = $$createType8;
const $$createField7_0 = $$createType0;
const $$createField8_0 = $$createType9;
let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
if ("GAP" in $$parsedSource) {
$$parsedSource["GAP"] = $$createField1_0($$parsedSource["GAP"]);
@ -86,6 +95,9 @@ export class AliasGroup {
if ("TPIPA" in $$parsedSource) {
$$parsedSource["TPIPA"] = $$createField7_0($$parsedSource["TPIPA"]);
}
if ("SPA" in $$parsedSource) {
$$parsedSource["SPA"] = $$createField8_0($$parsedSource["SPA"]);
}
return new AliasGroup($$parsedSource as Partial<AliasGroup>);
}
}
@ -268,6 +280,16 @@ export const StrangelyAliasedPerson = Person;
*/
export type StrangelyAliasedPerson = Person;
/**
* An alias referencing another package that is not used elsewhere.
*/
export const SubPackageAlias = subpkg$0.SubStruct;
/**
* An alias referencing another package that is not used elsewhere.
*/
export type SubPackageAlias = subpkg$0.SubStruct;
/**
* An alias that wraps a class through a typeparam alias.
*/
@ -288,3 +310,4 @@ const $$createType5 = $Create.Nullable($$createType4);
const $$createType6 = $Create.Map($Create.Any, $Create.Any);
const $$createType7 = $Create.Array($Create.Any);
const $$createType8 = GenericPerson.createFrom($$createType7);
const $$createType9 = subpkg$0.SubStruct.createFrom;

View file

@ -0,0 +1,6 @@
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
export {
SubStruct
} from "./models.js";

View file

@ -0,0 +1,37 @@
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore: Unused imports
import { Create as $Create } from "/wails/runtime.js";
/**
* SubStruct is a type in a subpackage that is only referenced through an alias.
*/
export class SubStruct {
"SomeField": string[];
/** Creates a new SubStruct instance. */
constructor($$source: Partial<SubStruct> = {}) {
if (!("SomeField" in $$source)) {
this["SomeField"] = [];
}
Object.assign(this, $$source);
}
/**
* Creates a new SubStruct instance from a string or object.
*/
static createFrom($$source: any = {}): SubStruct {
const $$createField0_0 = $$createType0;
let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
if ("SomeField" in $$parsedSource) {
$$parsedSource["SomeField"] = $$createField0_0($$parsedSource["SomeField"]);
}
return new SubStruct($$parsedSource as Partial<SubStruct>);
}
}
// Private type creation functions
const $$createType0 = $Create.Array($Create.Any);

View file

@ -10,6 +10,9 @@
// @ts-ignore: Unused imports
import { Call as $Call, CancellablePromise as $CancellablePromise, Create as $Create } from "/wails/runtime.js";
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore: Unused imports
import * as subpkg$0 from "./subpkg/models.js";
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore: Unused imports
import * as nobindingshere$0 from "../no_bindings_here/models.js";
@ -57,12 +60,18 @@ export function GetButGenericAliases(): $CancellablePromise<$models.AliasGroup>
});
}
export function GetButSubPackageAlias(): $CancellablePromise<$models.SubPackageAlias> {
return $Call.ByName("main.GreetService.GetButSubPackageAlias").then(($result: any) => {
return $$createType4($result);
});
}
/**
* Greet a lot of unusual things.
*/
export function Greet($0: $models.EmptyAliasStruct, $1: $models.EmptyStruct): $CancellablePromise<$models.AliasStruct> {
return $Call.ByName("main.GreetService.Greet", $0, $1).then(($result: any) => {
return $$createType7($result);
return $$createType8($result);
});
}
@ -71,12 +80,13 @@ const $$createType0 = $models.Person.createFrom;
const $$createType1 = $models.GenericPerson.createFrom($Create.Any);
const $$createType2 = nobindingshere$0.personImpl.createFrom;
const $$createType3 = $models.AliasGroup.createFrom;
const $$createType4 = $Create.Array($Create.Any);
const $$createType4 = subpkg$0.SubStruct.createFrom;
const $$createType5 = $Create.Array($Create.Any);
const $$createType6 = $Create.Struct({
"NoMoreIdeas": $$createType5,
});
const $$createType6 = $Create.Array($Create.Any);
const $$createType7 = $Create.Struct({
"Foo": $$createType4,
"Other": $$createType6,
"NoMoreIdeas": $$createType6,
});
const $$createType8 = $Create.Struct({
"Foo": $$createType5,
"Other": $$createType7,
});

View file

@ -15,6 +15,7 @@ export {
IndirectPersonAlias,
Person,
StrangelyAliasedPerson,
SubPackageAlias,
TPIndirectPersonAlias
} from "./models.js";

View file

@ -5,6 +5,10 @@
// @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 subpkg$0 from "./subpkg/models.js";
/**
* A nice type Alias.
*/
@ -22,6 +26,7 @@ export class AliasGroup {
"GPA": GenericPersonAlias<boolean>;
"IPA": IndirectPersonAlias;
"TPIPA": TPIndirectPersonAlias;
"SPA": SubPackageAlias;
/** Creates a new AliasGroup instance. */
constructor($$source: Partial<AliasGroup> = {}) {
@ -49,6 +54,9 @@ export class AliasGroup {
if (!("TPIPA" in $$source)) {
this["TPIPA"] = (new TPIndirectPersonAlias());
}
if (!("SPA" in $$source)) {
this["SPA"] = (new SubPackageAlias());
}
Object.assign(this, $$source);
}
@ -64,6 +72,7 @@ export class AliasGroup {
const $$createField5_0 = $$createType8;
const $$createField6_0 = $$createType8;
const $$createField7_0 = $$createType0;
const $$createField8_0 = $$createType9;
let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
if ("GAP" in $$parsedSource) {
$$parsedSource["GAP"] = $$createField1_0($$parsedSource["GAP"]);
@ -86,6 +95,9 @@ export class AliasGroup {
if ("TPIPA" in $$parsedSource) {
$$parsedSource["TPIPA"] = $$createField7_0($$parsedSource["TPIPA"]);
}
if ("SPA" in $$parsedSource) {
$$parsedSource["SPA"] = $$createField8_0($$parsedSource["SPA"]);
}
return new AliasGroup($$parsedSource as Partial<AliasGroup>);
}
}
@ -268,6 +280,16 @@ export const StrangelyAliasedPerson = Person;
*/
export type StrangelyAliasedPerson = Person;
/**
* An alias referencing another package that is not used elsewhere.
*/
export const SubPackageAlias = subpkg$0.SubStruct;
/**
* An alias referencing another package that is not used elsewhere.
*/
export type SubPackageAlias = subpkg$0.SubStruct;
/**
* An alias that wraps a class through a typeparam alias.
*/
@ -288,3 +310,4 @@ const $$createType5 = $Create.Nullable($$createType4);
const $$createType6 = $Create.Map($Create.Any, $Create.Any);
const $$createType7 = $Create.Array($Create.Any);
const $$createType8 = GenericPerson.createFrom($$createType7);
const $$createType9 = subpkg$0.SubStruct.createFrom;

View file

@ -0,0 +1,6 @@
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
export {
SubStruct
} from "./models.js";

View file

@ -0,0 +1,37 @@
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore: Unused imports
import { Create as $Create } from "/wails/runtime.js";
/**
* SubStruct is a type in a subpackage that is only referenced through an alias.
*/
export class SubStruct {
"SomeField": string[];
/** Creates a new SubStruct instance. */
constructor($$source: Partial<SubStruct> = {}) {
if (!("SomeField" in $$source)) {
this["SomeField"] = [];
}
Object.assign(this, $$source);
}
/**
* Creates a new SubStruct instance from a string or object.
*/
static createFrom($$source: any = {}): SubStruct {
const $$createField0_0 = $$createType0;
let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
if ("SomeField" in $$parsedSource) {
$$parsedSource["SomeField"] = $$createField0_0($$parsedSource["SomeField"]);
}
return new SubStruct($$parsedSource as Partial<SubStruct>);
}
}
// Private type creation functions
const $$createType0 = $Create.Array($Create.Any);

View file

@ -47,6 +47,10 @@ export function GetButGenericAliases(): $CancellablePromise<$models.AliasGroup>
return $Call.ByID(914093800);
}
export function GetButSubPackageAlias(): $CancellablePromise<$models.SubPackageAlias> {
return $Call.ByID(1443276371);
}
/**
* Greet a lot of unusual things.
*/

View file

@ -22,5 +22,6 @@ export type {
OtherAliasStruct,
Person,
StrangelyAliasedPerson,
SubPackageAlias,
TPIndirectPersonAlias
} from "./models.js";

View file

@ -1,6 +1,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 subpkg$0 from "./subpkg/models.js";
/**
* A nice type Alias.
*/
@ -18,6 +22,7 @@ export interface AliasGroup {
"GPA": GenericPersonAlias<boolean>;
"IPA": IndirectPersonAlias;
"TPIPA": TPIndirectPersonAlias;
"SPA": SubPackageAlias;
}
/**
@ -119,6 +124,11 @@ export interface Person {
*/
export type StrangelyAliasedPerson = Person;
/**
* An alias referencing another package that is not used elsewhere.
*/
export type SubPackageAlias = subpkg$0.SubStruct;
/**
* An alias that wraps a class through a typeparam alias.
*/

View file

@ -0,0 +1,6 @@
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
export type {
SubStruct
} from "./models.js";

View file

@ -0,0 +1,9 @@
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
/**
* SubStruct is a type in a subpackage that is only referenced through an alias.
*/
export interface SubStruct {
"SomeField": string[] | null;
}

View file

@ -47,6 +47,10 @@ export function GetButGenericAliases(): $CancellablePromise<$models.AliasGroup>
return $Call.ByName("main.GreetService.GetButGenericAliases");
}
export function GetButSubPackageAlias(): $CancellablePromise<$models.SubPackageAlias> {
return $Call.ByName("main.GreetService.GetButSubPackageAlias");
}
/**
* Greet a lot of unusual things.
*/

View file

@ -22,5 +22,6 @@ export type {
OtherAliasStruct,
Person,
StrangelyAliasedPerson,
SubPackageAlias,
TPIndirectPersonAlias
} from "./models.js";

View file

@ -1,6 +1,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 subpkg$0 from "./subpkg/models.js";
/**
* A nice type Alias.
*/
@ -18,6 +22,7 @@ export interface AliasGroup {
"GPA": GenericPersonAlias<boolean>;
"IPA": IndirectPersonAlias;
"TPIPA": TPIndirectPersonAlias;
"SPA": SubPackageAlias;
}
/**
@ -119,6 +124,11 @@ export interface Person {
*/
export type StrangelyAliasedPerson = Person;
/**
* An alias referencing another package that is not used elsewhere.
*/
export type SubPackageAlias = subpkg$0.SubStruct;
/**
* An alias that wraps a class through a typeparam alias.
*/

View file

@ -0,0 +1,6 @@
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
export type {
SubStruct
} from "./models.js";

View file

@ -0,0 +1,9 @@
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
/**
* SubStruct is a type in a subpackage that is only referenced through an alias.
*/
export interface SubStruct {
"SomeField": string[] | null;
}