mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-02 04:59:38 +08:00

* Add support to output ts models as interfaces * Add support to generate enums from golang * cleanup logs * add missing documentation * fix package names for enum. Fix processing enums that are in separate packages * revert golang 1.21 * Fix spelling * Add support for simplified version of Enum for typescriptify * update docs * removed unused logs * Add tests. Fix imported enums types in models --------- Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
51 lines
1.2 KiB
Go
51 lines
1.2 KiB
Go
package binding_test
|
|
|
|
import "github.com/wailsapp/wails/v2/internal/binding/binding_test/binding_test_import"
|
|
|
|
type ImportedEnumStruct struct {
|
|
EnumValue binding_test_import.ImportedEnum `json:"EnumValue"`
|
|
}
|
|
|
|
func (s ImportedEnumStruct) Get() ImportedEnumStruct {
|
|
return s
|
|
}
|
|
|
|
var ImportedEnumTest = BindingTest{
|
|
name: "ImportedEnum",
|
|
structs: []interface{}{
|
|
&ImportedEnumStruct{},
|
|
},
|
|
enums: []interface{}{
|
|
binding_test_import.AllImportedEnumValues,
|
|
},
|
|
exemptions: nil,
|
|
shouldError: false,
|
|
want: `export namespace binding_test {
|
|
|
|
export class ImportedEnumStruct {
|
|
EnumValue: binding_test_import.ImportedEnum;
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new ImportedEnumStruct(source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.EnumValue = source["EnumValue"];
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
export namespace binding_test_import {
|
|
|
|
export enum ImportedEnum {
|
|
Value1 = "value1",
|
|
Value2 = "value2",
|
|
Value3 = "value3",
|
|
}
|
|
|
|
}
|
|
`,
|
|
}
|