-
-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Arguments in JSClosure #155
Comments
What Xcode/Swift version are you using? On Xcode 13.2.1 (swift 5.5), I’m seeing that code build without errors. |
I have Xcode 13.2.1 (build version 13C100) and SwiftWasm 5.5. |
With this code, I get no errors (just a warning about variables being unused): import JavaScriptKit
public struct test {
public init() {
let closure = JSClosure { (arguments: [JSValue]) in
guard let item = arguments.first, let deviceId = item.string else {
// item in item.string causes error: ambiguous use of 'subscript(dynamicMember:)'
return .undefined
}
return .number(42)
}
}
} |
Thanks. Going through the cases one by one, I noticed that the problem was not with |
How is one supposed to use arguments in
JSClosure
? Is it necessary to unpack them manually from theJSValue
array? If I try to do that, I get an error message about ambiguous use ofsubscript(dynamicMember:)
:The text was updated successfully, but these errors were encountered: