Improve StringMap typing in jami-swig

Change-Id: I3773d7353878de9f5f01f957287afe48c6977e8b
diff --git a/server/src/interfaces.ts b/server/src/interfaces.ts
new file mode 100644
index 0000000..6131426
--- /dev/null
+++ b/server/src/interfaces.ts
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2022 Savoir-faire Linux Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation; either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public
+ * License along with this program.  If not, see
+ * <https://www.gnu.org/licenses/>.
+ */
+export interface Constructable<T> {
+  new (): T;
+}
diff --git a/server/src/jamid/jami-swig.ts b/server/src/jamid/jami-swig.ts
index 6ce5a71..8797b96 100644
--- a/server/src/jamid/jami-swig.ts
+++ b/server/src/jamid/jami-swig.ts
@@ -15,6 +15,7 @@
  * License along with this program.  If not, see
  * <https://www.gnu.org/licenses/>.
  */
+import { Constructable } from '../interfaces.js';
 import { itMap, itRange, itToArr, itToMap, itToRecord } from './utils.js';
 
 enum Bool {
@@ -93,12 +94,12 @@
   sendMessage(accountId: string, conversationId: string, message: string, replyTo: string): void;
   loadConversationMessages(accountId: string, conversationId: string, fromMessage: string, n: number): number;
 
-  // IntVect(): IntVect;
-  // UintVect(): UintVect;
-  // FloatVect(): FloatVect;
-  // StringVect(): StringVect;
-  // IntegerMap(): IntegerMap
-  // StringMap(): StringMap;
-  // VectMap(): VectMap;
-  // IntegerMap(): IntegerMap;
+  // IntVect: Constructable<IntVect>;
+  // UintVect: Constructable<UintVect>;
+  // FloatVect: Constructable<FloatVect>;
+  // StringVect: Constructable<StringVect>;
+  // IntegerMap: Constructable<IntegerMap>
+  StringMap: Constructable<StringMap>;
+  // VectMap: Constructable<VectMap>;
+  // IntegerMap: Constructable<IntegerMap>;
 }
diff --git a/server/src/jamid/jamid.ts b/server/src/jamid/jamid.ts
index 48c20f2..1b7ba40 100644
--- a/server/src/jamid/jamid.ts
+++ b/server/src/jamid/jamid.ts
@@ -106,7 +106,7 @@
   }
 
   setAccountDetails(accountId: string, accountDetails: AccountDetails) {
-    const accountDetailsStringMap: StringMap = new (this.jamiSwig as any).StringMap();
+    const accountDetailsStringMap: StringMap = new this.jamiSwig.StringMap();
     for (const [key, value] of Object.entries(accountDetails)) {
       accountDetailsStringMap.set(key, value);
     }
@@ -114,8 +114,7 @@
   }
 
   async addAccount(details: Map<string, string | number | boolean>) {
-    // TODO: Add proper typing directly into JamiSwig
-    const detailsStringMap: StringMap = new (this.jamiSwig as any).StringMap();
+    const detailsStringMap: StringMap = new this.jamiSwig.StringMap();
 
     detailsStringMap.set('Account.type', 'RING');
     for (const [key, value] of details.entries()) {