-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for interface generation and enums (#3047)
* 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 <[email protected]>
- Loading branch information
1 parent
929dfb4
commit b9de31e
Showing
24 changed files
with
717 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
v2/internal/binding/binding_test/binding_importedenum_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
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", | ||
} | ||
} | ||
`, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.