I encountered a problem trying to use
Gio.InputStream.read_bytes_finish() from Typescript, with bindings generated by ts-for-gjs. The underlying C function returns a GBytes* but it seems gjs is expected to convert it to ByteArray. ts-for-gjs seems to agree with this and has some sort of mapping to replace GLib.Bytes with ByteArray in the .d.ts files it outputs. However, this caused a run-time error in my code, because the returned object didn’t match ByteArray’s interface. Instead it seems to be a GLib.Bytes after all, and I can use it in Typescript by casting it as such.
So are ts-for-gjs and the above reference making a false assumption, or is there a bug in gjs which is preventing it from performing the conversion in just a few cases?