github.com/AlpineAIO/wails/v2@v2.0.0-beta.32.0.20240505041856-1047a8fa5fef/internal/binding/binding_test/binding_nonstringmapkey_test.go (about)

     1  package binding_test
     2  
     3  type NonStringMapKey struct {
     4  	NumberMap map[uint]any `json:"numberMap"`
     5  }
     6  
     7  func (s NonStringMapKey) Get() NonStringMapKey {
     8  	return s
     9  }
    10  
    11  var NonStringMapKeyTest = BindingTest{
    12  	name: "NonStringMapKey",
    13  	structs: []interface{}{
    14  		&NonStringMapKey{},
    15  	},
    16  	exemptions:  nil,
    17  	shouldError: false,
    18  	want: `
    19  export namespace binding_test {
    20  	export class NonStringMapKey {
    21  		numberMap: {[key: number]: any};
    22  		static createFrom(source: any = {}) {
    23  			return new NonStringMapKey(source);
    24  		}
    25  		constructor(source: any = {}) {
    26  			if ('string' === typeof source) source = JSON.parse(source);
    27  			this.numberMap = source["numberMap"];
    28  		}
    29  	}
    30  }
    31  `,
    32  }