'How do I use a named export from an external script in Angular?

https://stackblitz.com/edit/angular-ivy-4666q1?file=src%2Fdb%2Fdb.ts is a great demo of using Dexie in Angular, but instead of npm installing and importing, I would like to dynamically load Dexie AND Table from a CDN as described here: https://www.ngdevelop.tech/loading-external-libraries-from-cdn-in-angular-application/

After loading dynamically, my goal is to replace the following (db.ts line 1):

   import Dexie, { Table } from 'dexie';

with something like this:

   declare let Dexie: any;  

which works great for default export "Dexie", but not sure how to declare and use the named export interface "Table" which is needed for lines 20 and 21:

  todoItems!: Table<TodoItem, number>;
  todoLists!: Table<TodoList, number>;

Table in db.tsI've tried

   declare let Table: any;
  todoItems!: Dexie.Table<TodoItem, number>;

neither works. What should I do?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source