I am seeking assistance to enhance the IntelliSense capabilities in my codebase, My code snippet is as follows:
proc createModuleElements(width, height: int): JsObject {.importjs: "new ModuleElements({width: #, height: #})".}\
The createModuleElements procedure instantiates a JavaScript object named ModuleElements, and I would like to enable IntelliSense for this object. The ModuleElements object has a method called "loadElem."
const mod = createModuleElements({width: 500, height: 600})
mod.LoadElem(“directory model”)
Currently, Visual Studio Code's IntelliSense is not recognizing the "loadElem" method because it's imported from JavaScript. I was thinking i need to make my own object, annd recreate the methods in JavaScript and then assign the JS to it, but im not sure how to go about that heck if that’s even the right way. Thanks in advance!
maybe
import std/jsffi
type ModuleElements = distinct JsObject
proc createModuleElements(width, height: int): ModuleElements {.importjs: "new ModuleElements({width: #, height: #})".}
proc loadElem(m: ModuleElements, a: cstring) {.importjs: "#.LoadElem(#)".}
let module = createModuleElements(width=500, height=600)
module.loadElem("directory model")