 import CoreBluetooth
 
 extension RestoredState {
-    var asJSObject: Any {
+    var asJSObject: [AnyHashable: Any] {
         return [
-            "connectedPeripherals": peripherals.map { $0.asJSObject as AnyObject }
+            "connectedPeripherals": peripherals.map { $0.asJSObject } as [Any]
         ]
     }
 }
 
 extension ScannedPeripheral {
-    var asJSObject: Any {
+    var asJSObject: [AnyHashable: Any] {
         var serviceData: [String:String]?
         if let advServiceData = advertisementData.serviceData {
             var data = [String:String]()

    var jsIdentifier: Double {
        return Double(UInt64(objectId) & ((1 << 53) - 1))
    }
    var asJSObject: Any {
        return [
            "id": jsIdentifier,
            "uuid": uuid.fullUUIDString,

    var jsIdentifier: Double {
        return Double(UInt64(objectId) & ((1 << 53) - 1))
    }
    var asJSObject: [AnyHashable: Any] {
        return [
            "id": jsIdentifier,
            "uuid": uuid.fullUUIDString,
