Search code examples
dexie

How to add Dexie addons to TypeScript db file?


Hi does anyone know how to add addons to a TS Dexie db? This is what they show in the docs but they don't show how to do it in TS.

const db = new Dexie('MySyncedDB', {addons: [dexieCloud]});


Solution

  • In your constructor that derives from Dexie, pass the addons in your call to super()

    class MyDexie extends Dexie {
      ...
      constructor() {
        super('myDbName', { addons: [dexieCloud] });
        ...
      }
    }