mirror of
https://github.com/wavetermdev/wails.git
synced 2026-08-05 13:53:43 -07:00
fix: parse struct references for type generation (#2552)
* fix: parse struct references for type generation * chore: update changelog for typescript generation fix
This commit is contained in:
@@ -11,6 +11,7 @@ import (
|
||||
|
||||
const expectedPromiseBindings = `// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
import {binding_test} from '../models';
|
||||
|
||||
export function ErrorReturn(arg1:number):Promise<void>;
|
||||
|
||||
@@ -18,16 +19,37 @@ export function NoReturn(arg1:string):Promise<void>;
|
||||
|
||||
export function SingleReturn(arg1:any):Promise<number>;
|
||||
|
||||
export function SingleReturnStruct(arg1:any):Promise<binding_test.PromisesTestReturnStruct>;
|
||||
|
||||
export function SingleReturnStructPointer(arg1:any):Promise<binding_test.PromisesTestReturnStruct>;
|
||||
|
||||
export function SingleReturnStructPointerSlice(arg1:any):Promise<Array<binding_test.PromisesTestReturnStruct>>;
|
||||
|
||||
export function SingleReturnStructSlice(arg1:any):Promise<Array<binding_test.PromisesTestReturnStruct>>;
|
||||
|
||||
export function SingleReturnWithError(arg1:number):Promise<string>;
|
||||
|
||||
export function TwoReturn(arg1:any):Promise<string|number>;
|
||||
`
|
||||
|
||||
type PromisesTest struct{}
|
||||
type PromisesTestReturnStruct struct{}
|
||||
|
||||
func (h *PromisesTest) NoReturn(_ string) {}
|
||||
func (h *PromisesTest) ErrorReturn(_ int) error { return nil }
|
||||
func (h *PromisesTest) SingleReturn(_ interface{}) int { return 0 }
|
||||
func (h *PromisesTest) NoReturn(_ string) {}
|
||||
func (h *PromisesTest) ErrorReturn(_ int) error { return nil }
|
||||
func (h *PromisesTest) SingleReturn(_ interface{}) int { return 0 }
|
||||
func (h *PromisesTest) SingleReturnStructPointer(_ interface{}) *PromisesTestReturnStruct {
|
||||
return &PromisesTestReturnStruct{}
|
||||
}
|
||||
func (h *PromisesTest) SingleReturnStruct(_ interface{}) PromisesTestReturnStruct {
|
||||
return PromisesTestReturnStruct{}
|
||||
}
|
||||
func (h *PromisesTest) SingleReturnStructSlice(_ interface{}) []PromisesTestReturnStruct {
|
||||
return []PromisesTestReturnStruct{}
|
||||
}
|
||||
func (h *PromisesTest) SingleReturnStructPointerSlice(_ interface{}) []*PromisesTestReturnStruct {
|
||||
return []*PromisesTestReturnStruct{}
|
||||
}
|
||||
func (h *PromisesTest) SingleReturnWithError(_ int) (string, error) { return "", nil }
|
||||
func (h *PromisesTest) TwoReturn(_ interface{}) (string, int) { return "", 0 }
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ var valuePackageIndex int
|
||||
var valueTypeIndex int
|
||||
|
||||
func init() {
|
||||
mapRegex = regexp.MustCompile(`(?:map\[(?:(?P<keyPackage>\w+)\.)?(?P<keyType>\w+)])?(?P<valueArray>\[])?(?:(?P<valuePackage>\w+)\.)?(?P<valueType>.+)`)
|
||||
mapRegex = regexp.MustCompile(`(?:map\[(?:(?P<keyPackage>\w+)\.)?(?P<keyType>\w+)])?(?P<valueArray>\[])?(?:\*?(?P<valuePackage>\w+)\.)?(?P<valueType>.+)`)
|
||||
keyPackageIndex = mapRegex.SubexpIndex("keyPackage")
|
||||
keyTypeIndex = mapRegex.SubexpIndex("keyType")
|
||||
valueArrayIndex = mapRegex.SubexpIndex("valueArray")
|
||||
|
||||
@@ -37,6 +37,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- Fixed `runtime.MenuUpdateApplicationMenu` on macOS. Fixed by @stffabi in [PR](https://github.com/wailsapp/wails/pull/2588)
|
||||
- Fixed add package name for `libwebkit`/`pkg-config` and use shell.RunCommandWithENV instead of shell.RunCommand in `zypper.go`. Fixed by @wgjtyu in [PR](https://github.com/wailsapp/wails/pull/2593)
|
||||
- Make sure to start the CommonFileDialogs on Windows on the Main-Thread. Fixed by @stffabi in [PR](https://github.com/wailsapp/wails/pull/2606)
|
||||
- Fixed generated typescript bindings. Fixed by @dominictwlee in [PR](https://github.com/wailsapp/wails/pull/2552)
|
||||
|
||||
## v2.4.1 - 2023-03-20
|
||||
|
||||
|
||||
Reference in New Issue
Block a user