Skip to content

Commit

Permalink
Fixed issue where createFrom would misidentify strings as arrays (#3435)
Browse files Browse the repository at this point in the history
* Update check for Array-like variables

* Updated binding tests to reflect changes

* Update documentation to reflect changes

* Fixed PR number in changelog

---------

Co-authored-by: Lea Anthony <[email protected]>
  • Loading branch information
TwoNull and leaanthony authored Apr 27, 2024
1 parent 66562bf commit c10dfbc
Show file tree
Hide file tree
Showing 11 changed files with 17 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export namespace binding_test {
if (!a) {
return a;
}
if (a.slice) {
if (a.slice && a.map) {
return (a as any[]).map(elem => this.convertValues(elem, classs));
} else if ("object" === typeof a) {
if (asMap) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export namespace binding_test {
if (!a) {
return a;
}
if (a.slice) {
if (a.slice && a.map) {
return (a as any[]).map(elem => this.convertValues(elem, classs));
} else if ("object" === typeof a) {
if (asMap) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export namespace binding_test {
return a;
}
if (a.slice) {
if (a.slice && a.map) {
return (a as any[]).map(elem => this.convertValues(elem, classs));
} else if ("object" === typeof a) {
if (asMap) {
Expand Down
4 changes: 2 additions & 2 deletions v2/internal/binding/binding_test/binding_importedmap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export namespace binding_test {
if (!a) {
return a;
}
if (a.slice) {
if (a.slice && a.map) {
return (a as any[]).map(elem => this.convertValues(elem, classs));
} else if ("object" === typeof a) {
if (asMap) {
Expand Down Expand Up @@ -62,7 +62,7 @@ export namespace binding_test_import {
if (!a) {
return a;
}
if (a.slice) {
if (a.slice && a.map) {
return (a as any[]).map(elem => this.convertValues(elem, classs));
} else if ("object" === typeof a) {
if (asMap) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export namespace binding_test {
if (!a) {
return a;
}
if (a.slice) {
if (a.slice && a.map) {
return (a as any[]).map(elem => this.convertValues(elem, classs));
} else if ("object" === typeof a) {
if (asMap) {
Expand Down Expand Up @@ -62,7 +62,7 @@ export namespace binding_test_import {
if (!a) {
return a;
}
if (a.slice) {
if (a.slice && a.map) {
return (a as any[]).map(elem => this.convertValues(elem, classs));
} else if ("object" === typeof a) {
if (asMap) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export namespace binding_test {
return a;
}
if (a.slice) {
if (a.slice && a.map) {
return (a as any[]).map(elem => this.convertValues(elem, classs));
} else if ("object" === typeof a) {
if (asMap) {
Expand Down Expand Up @@ -63,7 +63,7 @@ export namespace binding_test_import {
if (!a) {
return a;
}
if (a.slice) {
if (a.slice && a.map) {
return (a as any[]).map(elem => this.convertValues(elem, classs));
} else if ("object" === typeof a) {
if (asMap) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export namespace binding_test {
if (!a) {
return a;
}
if (a.slice) {
if (a.slice && a.map) {
return (a as any[]).map(elem => this.convertValues(elem, classs));
} else if ("object" === typeof a) {
if (asMap) {
Expand Down
8 changes: 4 additions & 4 deletions v2/internal/binding/binding_test/binding_tsgeneration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export namespace binding_test {
if (!a) {
return a;
}
if (a.slice) {
if (a.slice && a.map) {
return (a as any[]).map(elem => this.convertValues(elem, classs));
} else if ("object" === typeof a) {
if (asMap) {
Expand Down Expand Up @@ -172,7 +172,7 @@ export namespace binding_test {
if (!a) {
return a;
}
if (a.slice) {
if (a.slice && a.map) {
return (a as any[]).map(elem => this.convertValues(elem, classs));
} else if ("object" === typeof a) {
if (asMap) {
Expand Down Expand Up @@ -204,7 +204,7 @@ export namespace binding_test {
if (!a) {
return a;
}
if (a.slice) {
if (a.slice && a.map) {
return (a as any[]).map(elem => this.convertValues(elem, classs));
} else if ("object" === typeof a) {
if (asMap) {
Expand Down Expand Up @@ -239,7 +239,7 @@ export namespace binding_test {
if (!a) {
return a;
}
if (a.slice) {
if (a.slice && a.map) {
return (a as any[]).map(elem => this.convertValues(elem, classs));
} else if ("object" === typeof a) {
if (asMap) {
Expand Down
2 changes: 1 addition & 1 deletion v2/internal/typescriptify/typescriptify.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const (
if (!a) {
return a;
}
if (a.slice) {
if (a.slice && a.map) {
return (a as any[]).map(elem => this.convertValues(elem, classs));
} else if ("object" === typeof a) {
if (asMap) {
Expand Down
2 changes: 1 addition & 1 deletion website/docs/howdoesitwork.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ export namespace main {
if (!a) {
return a;
}
if (a.slice) {
if (a.slice && a.map) {
return (a as any[]).map((elem) => this.convertValues(elem, classs));
} else if ("object" === typeof a) {
if (asMap) {
Expand Down
1 change: 1 addition & 0 deletions website/src/pages/changelog.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed

- Fixed an issue where certain calls to createFrom in TypeScript would fail. Changed by [@twonull](https://github.com/twonull) in [PR](https://github.com/wailsapp/wails/pull/3435)
- Fixed some typos in comments. Changed by [@reallylowest](https://github.com/reallylowest) in [PR](https://github.com/wailsapp/wails/pull/3357)
- Fixed an issue where the destination file was not properly closed after copying. Changed by [@testwill](https://github.com/testwill) in [PR](https://github.com/wailsapp/wails/pull/3384)
- Fixed an issue where `xattr` calls were not working. Fixed by [@leaanthony](https://github.com/wailsapp/wails/pull/3328)
Expand Down

0 comments on commit c10dfbc

Please sign in to comment.