Curious. That sounds like a bug, I’d expect that to work. What’s the exact full error message? Does it say what the type is that can’t be cast to Intever?
http://127.0.0.1:63199/wasm/RemObjectsElements.js:298 Fatal exception in WebAssembly! http://127.0.0.1:63199/wasm/RemObjectsElements.js:298 Exception: RemObjects.Elements.System.InvalidCastException: Invalid cast
!> Exception of type RuntimeError on thread 0001
!> Message: RuntimeError: unreachable
!> at ElementsRaiseException (wasm-function[2336]:0xa5556)
!> at mi_t17_WebAPI__Comms_d_Programf_DoOnButtonClicknad (wasm-function[2788]:0xc7582)
!> at mi_t17_WebAPI__Comms_d_Program13__l_InitGUI_g_b____1nt13__1sEcmaScriptObject (wasm-function[2785]:0xc66e9)
!> at mi_t16__1sWebAssemblyDelegate6_Invokent13__1sEcmaScriptObject (wasm-function[626]:0x61c8d)
!> at __island_call_delegate (wasm-function[2337]:0xa5581)
!> at HTMLButtonElement.res (http://127.0.0.1:63199/wasm/RemObjectsElements.js:267:66)
Detached
#> (edb)
~> Process WebAPI_Comms terminated with exit code 0
My apologies; it seems I lost track of this one. It looks, like a bug, possibly with string concatenation on dynamics that aren’t strings. I’ll log to have this investigated.
Oddly, this fails for me too, with a very weird error (logged separately):
var d: dynamic := Browser.GetElementById('myDiv');
var a := 'Child Count: ' + d.children.length; // works fine
writeLn($'a {a}'); // prints it fine
writeLn($'Child Count: {d.children.length}'); // ok
writeLn('Child Count: ' + d.children.length); // fails with "No element with this name: writeLn"
that said,
I can repro that .length apparently can be assigned to a Double, but not to an Integer (the original issue); not sure why yet.