Fix error on account creation

Change-Id: Ie8fe7f0bb8e6a2f55a09196530eebac0a10746d3
diff --git a/model/Account.ts b/model/Account.ts
index ce529c0..0355de4 100644
--- a/model/Account.ts
+++ b/model/Account.ts
@@ -25,14 +25,14 @@
   private readonly id: string;
   private _details: AccountDetails;
   private _volatileDetails: VolatileDetails;
-  private contactCache: Record<string, Contact> = {};
-  private _contacts: Contact[] = [];
-  private conversations: Record<string, Conversation> = {};
-  private defaultModerators: Contact[] = [];
-  private _lookups: Lookup[] = [];
-  private devices: Devices = {};
-  private _registrationState: RegistrationState | undefined = undefined;
-  private _registeringName: AccountRegisteringName | undefined = undefined;
+  private readonly contactCache: Record<string, Contact>;
+  private _contacts: Contact[];
+  private readonly conversations: Record<string, Conversation>;
+  private defaultModerators: Contact[];
+  private _lookups: Lookup[];
+  private devices: Devices;
+  private _registrationState: RegistrationState | undefined;
+  private _registeringName: AccountRegisteringName | undefined;
 
   static TYPE_JAMI: string;
   static TYPE_SIP: string;
@@ -41,13 +41,21 @@
 
   constructor(id: string, details: AccountDetails, volatileDetails: VolatileDetails) {
     this.id = id;
-    this._details = details;
-    this._volatileDetails = volatileDetails;
+    this._details = details || {};
+    this._volatileDetails = volatileDetails || {};
+    this.contactCache = {};
+    this._contacts = [];
+    this.conversations = {};
+    this.defaultModerators = [];
+    this._lookups = [];
+    this.devices = {};
+    this.registrationState = undefined;
+    this._registeringName = undefined;
   }
 
-  static from(object: Account) {
-    const account = new Account(object.id, object._details, object._volatileDetails);
-    if (object.defaultModerators) account.defaultModerators = object.defaultModerators.map((m) => Contact.from(m));
+  static from(object: any) {
+    const account = new Account(object.id, object.details, object.volatileDetails);
+    if (object.defaultModerators) account.defaultModerators = object.defaultModerators.map((m: any) => Contact.from(m));
     return account;
   }
 
diff --git a/model/Contact.ts b/model/Contact.ts
index 01d4a02..fd05f1a 100644
--- a/model/Contact.ts
+++ b/model/Contact.ts
@@ -1,13 +1,15 @@
 class Contact {
   private readonly uri: string;
-  private displayName: string | undefined = undefined;
-  private registeredName: string | undefined = undefined;
+  private readonly displayName: string | undefined;
+  private registeredName: string | undefined;
 
   constructor(uri: string) {
     this.uri = uri;
+    this.displayName = undefined;
+    this.registeredName = undefined;
   }
 
-  static from(object: Contact) {
+  static from(object: any) {
     const contact = new Contact(object.uri);
     if (object.registeredName) contact.setRegisteredName(object.registeredName);
     return contact;
diff --git a/model/Conversation.ts b/model/Conversation.ts
index 3a75567..45e9a35 100644
--- a/model/Conversation.ts
+++ b/model/Conversation.ts
@@ -25,22 +25,27 @@
   private readonly id: string | undefined;
   private readonly accountId: string;
   private readonly members: ConversationMember[];
-  private messages: Message[] = [];
-  private _infos: ConversationInfos = {};
-  private _requests: Record<string, ConversationRequest> = {};
-  private _listeners: ConversationListeners = {};
+  private messages: Message[];
+  private _infos: ConversationInfos;
+  private _requests: Record<string, ConversationRequest>;
+  private _listeners: ConversationListeners;
 
   constructor(id: string | undefined, accountId: string, members?: ConversationMember[]) {
     this.id = id;
     this.accountId = accountId;
     this.members = members || [];
+
+    this.messages = [];
+    this._infos = {};
+    this._requests = {};
+    this._listeners = {};
   }
 
-  static from(accountId: string, object: Conversation) {
+  static from(accountId: string, object: any) {
     const conversation = new Conversation(
       object.id,
       accountId,
-      object.members.map((member) => {
+      object.members.map((member: any) => {
         member.contact = Contact.from(member.contact);
         return member;
       })