Skip to content

Commit 5c6d8a9

Browse files
committed
Testdata for typed events
1 parent 56640ef commit 5c6d8a9

File tree

56 files changed

+1000
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+1000
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
//@ts-check
2+
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
3+
// This file is automatically generated. DO NOT EDIT
4+
5+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
6+
// @ts-ignore: Unused imports
7+
import { Create as $Create } from "/wails/runtime.js";
8+
9+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
10+
// @ts-ignore: Unused imports
11+
import * as json$0 from "../../../../../encoding/json/models.js";
12+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
13+
// @ts-ignore: Unused imports
14+
import * as events_only$0 from "./generator/testcases/events_only/models.js";
15+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
16+
// @ts-ignore: Unused imports
17+
import * as more$0 from "./generator/testcases/no_bindings_here/more/models.js";
18+
19+
function configure() {
20+
Object.freeze(Object.assign($Create.Events, {
21+
"events_only:class": $$createType0,
22+
"events_only:map": $$createType2,
23+
"events_only:other": $$createType3,
24+
"overlap": $$createType6,
25+
}));
26+
}
27+
28+
// Private type creation functions
29+
const $$createType0 = events_only$0.SomeClass.createFrom;
30+
const $$createType1 = $Create.Array($Create.Any);
31+
const $$createType2 = $Create.Map($Create.Any, $$createType1);
32+
const $$createType3 = $Create.Array($Create.Any);
33+
const $$createType4 = $Create.Array($Create.Any);
34+
const $$createType5 = $Create.Struct({
35+
"Field": $$createType4,
36+
});
37+
const $$createType6 = $Create.Nullable($$createType5);
38+
39+
configure();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
2+
// This file is automatically generated. DO NOT EDIT
3+
4+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
5+
// @ts-ignore: Unused imports
6+
import type { Events } from "/wails/runtime.js";
7+
8+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
9+
// @ts-ignore: Unused imports
10+
import type * as json$0 from "../../../../../encoding/json/models.js";
11+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
12+
// @ts-ignore: Unused imports
13+
import type * as events_only$0 from "./generator/testcases/events_only/models.js";
14+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
15+
// @ts-ignore: Unused imports
16+
import type * as more$0 from "./generator/testcases/no_bindings_here/more/models.js";
17+
18+
declare module "/wails/runtime.js" {
19+
namespace Events {
20+
interface CustomEvents {
21+
"events_only:class": events_only$0.SomeClass;
22+
"events_only:map": { [_: string]: number[] };
23+
"events_only:other": more$0.StringPtr[];
24+
"events_only:string": string;
25+
"interface": json$0.Marshaler;
26+
"overlap": {"Field": boolean[]} | null;
27+
}
28+
}
29+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// @ts-check
2+
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
3+
// This file is automatically generated. DO NOT EDIT
4+
5+
export {
6+
SomeClass
7+
} from "./models.js";
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
// @ts-check
2+
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
3+
// This file is automatically generated. DO NOT EDIT
4+
5+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
6+
// @ts-ignore: Unused imports
7+
import { Create as $Create } from "/wails/runtime.js";
8+
9+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
10+
// @ts-ignore: Unused imports
11+
import * as nobindingshere$0 from "../no_bindings_here/models.js";
12+
13+
/**
14+
* SomeClass renders as a TS class.
15+
*/
16+
export class SomeClass {
17+
/**
18+
* Creates a new SomeClass instance.
19+
* @param {Partial<SomeClass>} [$$source = {}] - The source object to create the SomeClass.
20+
*/
21+
constructor($$source = {}) {
22+
if (!("Field" in $$source)) {
23+
/**
24+
* @member
25+
* @type {string}
26+
*/
27+
this["Field"] = "";
28+
}
29+
if (!("Meadow" in $$source)) {
30+
/**
31+
* @member
32+
* @type {nobindingshere$0.HowDifferent<number>}
33+
*/
34+
this["Meadow"] = (new nobindingshere$0.HowDifferent());
35+
}
36+
37+
Object.assign(this, $$source);
38+
}
39+
40+
/**
41+
* Creates a new SomeClass instance from a string or object.
42+
* @param {any} [$$source = {}]
43+
* @returns {SomeClass}
44+
*/
45+
static createFrom($$source = {}) {
46+
const $$createField1_0 = $$createType0;
47+
let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
48+
if ("Meadow" in $$parsedSource) {
49+
$$parsedSource["Meadow"] = $$createField1_0($$parsedSource["Meadow"]);
50+
}
51+
return new SomeClass(/** @type {Partial<SomeClass>} */($$parsedSource));
52+
}
53+
}
54+
55+
// Private type creation functions
56+
const $$createType0 = nobindingshere$0.HowDifferent.createFrom($Create.Any);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// @ts-check
2+
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
3+
// This file is automatically generated. DO NOT EDIT
4+
5+
import * as $models from "./models.js";
6+
7+
/**
8+
* StringPtr is a nullable string.
9+
* @typedef {$models.StringPtr} StringPtr
10+
*/
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// @ts-check
2+
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
3+
// This file is automatically generated. DO NOT EDIT
4+
5+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
6+
// @ts-ignore: Unused imports
7+
import { Create as $Create } from "/wails/runtime.js";
8+
9+
/**
10+
* StringPtr is a nullable string.
11+
* @typedef {string | null} StringPtr
12+
*/

v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/warnings.log

+13
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
/Users/fabio/Development/wails/v3/internal/generator/testcases/complex_json/main.go:127:2: event 'collision' has one of multiple definitions here with data type map[string]int
2+
/Users/fabio/Development/wails/v3/internal/generator/testcases/events_only/events.go:20:2: event 'collision' has one of multiple definitions here with data type int
3+
/Users/fabio/Development/wails/v3/internal/generator/testcases/events_only/events.go:21:2: `application.RegisterEvent` called here with non-constant event name
4+
/Users/fabio/Development/wails/v3/internal/generator/testcases/events_only/other.go:10:5: `application.RegisterEvent` is instantiated here but not called
5+
/Users/fabio/Development/wails/v3/internal/generator/testcases/events_only/other.go:13:2: `application.RegisterEvent` called here with non-constant event name
6+
/Users/fabio/Development/wails/v3/internal/generator/testcases/events_only/other.go:17:2: data type []T for event 'parametric' contains unresolved type parameters and will be ignored`
7+
/Users/fabio/Development/wails/v3/internal/generator/testcases/events_only/other.go:22:2: event 'common:ApplicationStarted' is a known system event and cannot be overridden; this call to `application.RegisterEvent` will panic
8+
/Users/fabio/Development/wails/v3/internal/generator/testcases/marshalers/main.go:212:2: event 'collision' has one of multiple definitions here with data type *struct{Field []bool}
9+
/Users/fabio/Development/wails/v3/internal/generator/testcases/marshalers/main.go:214:2: data type encoding/json.Marshaler for event 'interface' is a non-empty interface: emitting events from the frontend with data other than `null` is not supported by encoding/json and will likely result in runtime errors
10+
dynamically registered event names are not discoverable by the binding generator: it is recommended to invoke `application.RegisterEvent` with constant arguments only
11+
event 'collision' has multiple conflicting definitions and will be ignored
12+
events registered through indirect calls are not discoverable by the binding generator: it is recommended to invoke `application.RegisterEvent` directly
13+
generic wrappers for calls to `application.RegisterEvent` are not analysable by the binding generator: it is recommended to call `application.RegisterEvent` with concrete types only
114
package github.com/wailsapp/wails/v3/internal/generator/testcases/map_keys: type *R is used as a map key, but some of its instantiations might not implement encoding.TextMarshaler: this might result in runtime errors
215
package github.com/wailsapp/wails/v3/internal/generator/testcases/map_keys: type *S is used as a map key, but some of its instantiations might not implement encoding.TextMarshaler: this might result in runtime errors
316
package github.com/wailsapp/wails/v3/internal/generator/testcases/map_keys: type *T is used as a map key, but some of its instantiations might not implement encoding.TextMarshaler: this might result in runtime errors
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
//@ts-check
2+
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
3+
// This file is automatically generated. DO NOT EDIT
4+
5+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
6+
// @ts-ignore: Unused imports
7+
import { Create as $Create } from "/wails/runtime.js";
8+
9+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
10+
// @ts-ignore: Unused imports
11+
import * as json$0 from "../../../../../encoding/json/models.js";
12+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
13+
// @ts-ignore: Unused imports
14+
import * as events_only$0 from "./generator/testcases/events_only/models.js";
15+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
16+
// @ts-ignore: Unused imports
17+
import * as more$0 from "./generator/testcases/no_bindings_here/more/models.js";
18+
19+
function configure() {
20+
Object.freeze(Object.assign($Create.Events, {
21+
"events_only:class": $$createType0,
22+
"events_only:map": $$createType2,
23+
"events_only:other": $$createType3,
24+
"overlap": $$createType6,
25+
}));
26+
}
27+
28+
// Private type creation functions
29+
const $$createType0 = events_only$0.SomeClass.createFrom;
30+
const $$createType1 = $Create.Array($Create.Any);
31+
const $$createType2 = $Create.Map($Create.Any, $$createType1);
32+
const $$createType3 = $Create.Array($Create.Any);
33+
const $$createType4 = $Create.Array($Create.Any);
34+
const $$createType5 = $Create.Struct({
35+
"Field": $$createType4,
36+
});
37+
const $$createType6 = $Create.Nullable($$createType5);
38+
39+
configure();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
2+
// This file is automatically generated. DO NOT EDIT
3+
4+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
5+
// @ts-ignore: Unused imports
6+
import type { Events } from "/wails/runtime.js";
7+
8+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
9+
// @ts-ignore: Unused imports
10+
import type * as json$0 from "../../../../../encoding/json/models.js";
11+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
12+
// @ts-ignore: Unused imports
13+
import type * as events_only$0 from "./generator/testcases/events_only/models.js";
14+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
15+
// @ts-ignore: Unused imports
16+
import type * as more$0 from "./generator/testcases/no_bindings_here/more/models.js";
17+
18+
declare module "/wails/runtime.js" {
19+
namespace Events {
20+
interface CustomEvents {
21+
"events_only:class": events_only$0.SomeClass;
22+
"events_only:map": { [_: string]: number[] };
23+
"events_only:other": more$0.StringPtr[];
24+
"events_only:string": string;
25+
"interface": json$0.Marshaler;
26+
"overlap": {"Field": boolean[]} | null;
27+
}
28+
}
29+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// @ts-check
2+
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
3+
// This file is automatically generated. DO NOT EDIT
4+
5+
export {
6+
SomeClass
7+
} from "./models.js";
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
// @ts-check
2+
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
3+
// This file is automatically generated. DO NOT EDIT
4+
5+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
6+
// @ts-ignore: Unused imports
7+
import { Create as $Create } from "/wails/runtime.js";
8+
9+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
10+
// @ts-ignore: Unused imports
11+
import * as nobindingshere$0 from "../no_bindings_here/models.js";
12+
13+
/**
14+
* SomeClass renders as a TS class.
15+
*/
16+
export class SomeClass {
17+
/**
18+
* Creates a new SomeClass instance.
19+
* @param {Partial<SomeClass>} [$$source = {}] - The source object to create the SomeClass.
20+
*/
21+
constructor($$source = {}) {
22+
if (!("Field" in $$source)) {
23+
/**
24+
* @member
25+
* @type {string}
26+
*/
27+
this["Field"] = "";
28+
}
29+
if (!("Meadow" in $$source)) {
30+
/**
31+
* @member
32+
* @type {nobindingshere$0.HowDifferent<number>}
33+
*/
34+
this["Meadow"] = (new nobindingshere$0.HowDifferent());
35+
}
36+
37+
Object.assign(this, $$source);
38+
}
39+
40+
/**
41+
* Creates a new SomeClass instance from a string or object.
42+
* @param {any} [$$source = {}]
43+
* @returns {SomeClass}
44+
*/
45+
static createFrom($$source = {}) {
46+
const $$createField1_0 = $$createType0;
47+
let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
48+
if ("Meadow" in $$parsedSource) {
49+
$$parsedSource["Meadow"] = $$createField1_0($$parsedSource["Meadow"]);
50+
}
51+
return new SomeClass(/** @type {Partial<SomeClass>} */($$parsedSource));
52+
}
53+
}
54+
55+
// Private type creation functions
56+
const $$createType0 = nobindingshere$0.HowDifferent.createFrom($Create.Any);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// @ts-check
2+
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
3+
// This file is automatically generated. DO NOT EDIT
4+
5+
import * as $models from "./models.js";
6+
7+
/**
8+
* StringPtr is a nullable string.
9+
* @typedef {$models.StringPtr} StringPtr
10+
*/
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// @ts-check
2+
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
3+
// This file is automatically generated. DO NOT EDIT
4+
5+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
6+
// @ts-ignore: Unused imports
7+
import { Create as $Create } from "/wails/runtime.js";
8+
9+
/**
10+
* StringPtr is a nullable string.
11+
* @typedef {string | null} StringPtr
12+
*/

v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/warnings.log

+13
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
/Users/fabio/Development/wails/v3/internal/generator/testcases/complex_json/main.go:127:2: event 'collision' has one of multiple definitions here with data type map[string]int
2+
/Users/fabio/Development/wails/v3/internal/generator/testcases/events_only/events.go:20:2: event 'collision' has one of multiple definitions here with data type int
3+
/Users/fabio/Development/wails/v3/internal/generator/testcases/events_only/events.go:21:2: `application.RegisterEvent` called here with non-constant event name
4+
/Users/fabio/Development/wails/v3/internal/generator/testcases/events_only/other.go:10:5: `application.RegisterEvent` is instantiated here but not called
5+
/Users/fabio/Development/wails/v3/internal/generator/testcases/events_only/other.go:13:2: `application.RegisterEvent` called here with non-constant event name
6+
/Users/fabio/Development/wails/v3/internal/generator/testcases/events_only/other.go:17:2: data type []T for event 'parametric' contains unresolved type parameters and will be ignored`
7+
/Users/fabio/Development/wails/v3/internal/generator/testcases/events_only/other.go:22:2: event 'common:ApplicationStarted' is a known system event and cannot be overridden; this call to `application.RegisterEvent` will panic
8+
/Users/fabio/Development/wails/v3/internal/generator/testcases/marshalers/main.go:212:2: event 'collision' has one of multiple definitions here with data type *struct{Field []bool}
9+
/Users/fabio/Development/wails/v3/internal/generator/testcases/marshalers/main.go:214:2: data type encoding/json.Marshaler for event 'interface' is a non-empty interface: emitting events from the frontend with data other than `null` is not supported by encoding/json and will likely result in runtime errors
10+
dynamically registered event names are not discoverable by the binding generator: it is recommended to invoke `application.RegisterEvent` with constant arguments only
11+
event 'collision' has multiple conflicting definitions and will be ignored
12+
events registered through indirect calls are not discoverable by the binding generator: it is recommended to invoke `application.RegisterEvent` directly
13+
generic wrappers for calls to `application.RegisterEvent` are not analysable by the binding generator: it is recommended to call `application.RegisterEvent` with concrete types only
114
package github.com/wailsapp/wails/v3/internal/generator/testcases/map_keys: type *R is used as a map key, but some of its instantiations might not implement encoding.TextMarshaler: this might result in runtime errors
215
package github.com/wailsapp/wails/v3/internal/generator/testcases/map_keys: type *S is used as a map key, but some of its instantiations might not implement encoding.TextMarshaler: this might result in runtime errors
316
package github.com/wailsapp/wails/v3/internal/generator/testcases/map_keys: type *T is used as a map key, but some of its instantiations might not implement encoding.TextMarshaler: this might result in runtime errors
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
//@ts-check
2+
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
3+
// This file is automatically generated. DO NOT EDIT
4+
5+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
6+
// @ts-ignore: Unused imports
7+
import { Create as $Create } from "/wails/runtime.js";
8+
9+
Object.freeze($Create.Events);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
2+
// This file is automatically generated. DO NOT EDIT
3+
4+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
5+
// @ts-ignore: Unused imports
6+
import type { Events } from "/wails/runtime.js";
7+
8+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
9+
// @ts-ignore: Unused imports
10+
import type * as json$0 from "../../../../../encoding/json/models.js";
11+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
12+
// @ts-ignore: Unused imports
13+
import type * as events_only$0 from "./generator/testcases/events_only/models.js";
14+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
15+
// @ts-ignore: Unused imports
16+
import type * as more$0 from "./generator/testcases/no_bindings_here/more/models.js";
17+
18+
declare module "/wails/runtime.js" {
19+
namespace Events {
20+
interface CustomEvents {
21+
"events_only:class": events_only$0.SomeClass;
22+
"events_only:map": { [_: string]: number[] | null } | null;
23+
"events_only:other": more$0.StringPtr[] | null;
24+
"events_only:string": string;
25+
"interface": json$0.Marshaler;
26+
"overlap": {"Field": boolean[] | null} | null;
27+
}
28+
}
29+
}

0 commit comments

Comments
 (0)