Totally lost on how to call a member of a JavaScriptKit object

i have an instance of URLSearchParams that i am trying to pass to Swift code as a JSObject.

to call the get(_:) method of the JavaScript object, one must do something like this:

let value: JSValue? = self.object.get?(key.rawValue)

my Google Gemini instance is adamant that this is invalid, it insists that this does not correctly preserve this context. neither i, nor the LLM can figure out what the correct invocation is.

what is the right way to call an instance method on a JavaScript object, from Swift?

and as a higher-level question, this has been a frequent experience of mine when trying to use JavaScriptKit with the assistance of an LLM, that the LLM is rather helpless with Swift WebAssembly tasks. are there any books/resources i can upload to the LLM (perhaps with the “upload repo” feature) to help it understand this domain better? has anyone found an effective workflow for using Swift WebAssembly with LLM assistance?

dug into the source code of JavaScriptKit and it seems the binding of this is handled automatically when extracting the closure instance. so everything in JavaScriptKit Just Works! it was only Google Gemini that had no clue how to use it.

of course it’s still not great that LLMs cannot effectively contribute to Swift WebAssembly projects, especially when compared to other tech stacks where LLMs are effective force multipliers for developers…