Net.Socket js Cannot cast T to <function> String

#if (js && html5)
__socket.send (cast (__output, ArrayBuffer));

At approximately line 186, is yielding an exception of the following nature:

Cannot cast T to <function> String 

Is there a way to fix this? This is with haxe 3.2.1

__output is of type ByteArray. I’ve looked at the code for ByteArray briefly but it is quite complicated and it is not immediately obvious what it’s actual type is.

ByteArray objects should be automatically converted to ArrayBuffer if necessarily. The conversion looks like this:

return (byteArray:ByteArrayData).getData ()

Try calling (__output:ByteArrayData).getData() yourself, and see if it gives the same error. Also try Reflect.hasField(__output, "getData") to see if it’s the right type of object. And while you’re at it, make sure __output isn’t null.