feat(nbstore): add awareness storage&sync&frontend (#9016)

This commit is contained in:
EYHN
2024-12-17 04:37:15 +00:00
parent 36ac79351f
commit ffa0231cf5
21 changed files with 572 additions and 26 deletions
+5 -2
View File
@@ -3,7 +3,7 @@ import EventEmitter2 from 'eventemitter2';
import type { ConnectionStatus } from '../connection';
import type { BlobStorage } from './blob';
import type { DocStorage } from './doc';
import { type Storage, type StorageType } from './storage';
import type { Storage, StorageType } from './storage';
import type { SyncStorage } from './sync';
type Storages = DocStorage | BlobStorage | SyncStorage;
@@ -22,7 +22,10 @@ export class SpaceStorage {
tryGet<T extends StorageType>(
type: T
): Extract<Storages, { storageType: T }> | undefined {
return this.storages.get(type) as Extract<Storages, { storageType: T }>;
return this.storages.get(type) as unknown as Extract<
Storages,
{ storageType: T }
>;
}
get<T extends StorageType>(type: T): Extract<Storages, { storageType: T }> {