fix: type import (#2715)

(cherry picked from commit 7f2006488e)
This commit is contained in:
Himself65
2023-06-07 22:47:02 +08:00
committed by Alex Yang
parent cd5aec42a0
commit 28e05dc92c
24 changed files with 60 additions and 91 deletions
+2
View File
@@ -102,9 +102,11 @@ export const CRUD: WorkspaceCRUD<WorkspaceFlavour.LOCAL> = {
// workspaces in desktop
if (window.apis && environment.isDesktop) {
// @ts-expect-error
const desktopIds = (await window.apis.workspace.list()).map(([id]) => id);
// the ids maybe a subset of the local storage
const moreWorkspaces = desktopIds.filter(
// @ts-expect-error
id => !allWorkspaceIDs.includes(id)
);
allWorkspaceIDs = [...allWorkspaceIDs, ...moreWorkspaces];
@@ -39,6 +39,7 @@ vi.stubGlobal('window', {
},
events: {
db: {
// @ts-expect-error
onExternalUpdate: fn => {
triggerDBUpdate = fn;
return () => {
@@ -113,6 +114,7 @@ describe('SQLite download provider', () => {
offlineYdoc.getText('text').insert(0, 'sqlite-world');
// @ts-expect-error
triggerDBUpdate?.({
workspaceId: id + '-another-id',
update: Y.encodeStateAsUpdate(offlineYdoc),
@@ -121,6 +123,7 @@ describe('SQLite download provider', () => {
// not yet updated (because the workspace id is different)
expect(workspace.doc.getText('text').toString()).toBe('');
// @ts-expect-error
triggerDBUpdate?.({
workspaceId: id,
update: Y.encodeStateAsUpdate(offlineYdoc),
@@ -183,6 +183,7 @@ const createSQLiteProvider = (
const connect = () => {
logger.info('connecting sqlite provider', blockSuiteWorkspace.id);
blockSuiteWorkspace.doc.on('update', handleUpdate);
// @ts-expect-error
unsubscribe = events.db.onExternalUpdate(({ update, workspaceId }) => {
if (workspaceId === blockSuiteWorkspace.id) {
Y.applyUpdate(blockSuiteWorkspace.doc, update, sqliteOrigin);
-6
View File
@@ -1,17 +1,11 @@
// eslint-disable-next-line @typescript-eslint/triple-slash-reference
/// <reference path="../../../apps/electron/layers/preload/preload.d.ts" />
import type { View } from '@affine/component/page-list/filter/shared-types';
import type { EditorContainer } from '@blocksuite/editor';
import type { Page } from '@blocksuite/store';
import type { Workspace as BlockSuiteWorkspace } from '@blocksuite/store';
import type { createStore } from 'jotai';
import type { FC, PropsWithChildren } from 'react';
import type { Workspace as RemoteWorkspace } from './affine/api';
export type JotaiStore = ReturnType<typeof createStore>;
export enum WorkspaceSubPath {
ALL = 'all',
SETTING = 'setting',