just remove the type C0FPacketConfirmTransaction then. Since JavaScript is a dynamically typed language, the type is determined at runtime. If the packet is a instance of a C0FPacketConfirmTransaction you can call getWindowId() and getUid() then if it is not, exceptions should be thrown.
//if (event.getPacket() instanceof C0FPacketConfirmTransaction)
packetConfirmTransaction = event.getPacket();