Skip to content

Commit

Permalink
Up storage TS
Browse files Browse the repository at this point in the history
  • Loading branch information
artf committed Sep 16, 2023
1 parent 0c01cf6 commit 620a3e9
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/storage_manager/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,7 @@ export default class StorageManager extends Module<
* });
* */
add<T extends StorageOptions>(type: string, storage: IStorage<T>) {
// @ts-ignore
this.storages[type] = storage;
this.storages[type] = storage as IStorage;
return this;
}

Expand Down Expand Up @@ -214,7 +213,7 @@ export default class StorageManager extends Module<
* const data = editor.getProjectData();
* await storageManager.store(data);
* */
async store(data: ProjectData, options: StorageOptions = {}) {
async store<T extends StorageOptions>(data: ProjectData, options: T = {} as T) {
const st = this.getCurrentStorage();
const opts = { ...this.getCurrentOptions(), ...options };
const recovery = this.getRecoveryStorage();
Expand Down Expand Up @@ -242,7 +241,7 @@ export default class StorageManager extends Module<
* const data = await storageManager.load();
* editor.loadProjectData(data);
* */
async load(options = {}) {
async load<T extends StorageOptions>(options: T = {} as T) {
const st = this.getCurrentStorage();
const opts = { ...this.getCurrentOptions(), ...options };
const recoveryStorage = this.getRecoveryStorage();
Expand Down

0 comments on commit 620a3e9

Please sign in to comment.