From 7d16a8348c4221a73e25bd72ed44ed045d3e31f0 Mon Sep 17 00:00:00 2001 From: Camol Date: Tue, 8 Aug 2023 23:46:23 +0800 Subject: [PATCH] chore: add `@types/addfine__env` to the devDep (#3616) --- .../components/affine/create-workspace-modal/index.tsx | 9 +++++++-- .../affine/new-workspace-setting-detail/export.tsx | 5 ++++- .../affine/new-workspace-setting-detail/storage.tsx | 3 ++- package.json | 1 + tsconfig.json | 2 -- yarn.lock | 3 ++- 6 files changed, 16 insertions(+), 7 deletions(-) diff --git a/apps/core/src/components/affine/create-workspace-modal/index.tsx b/apps/core/src/components/affine/create-workspace-modal/index.tsx index a39f51e351..6c728d5040 100644 --- a/apps/core/src/components/affine/create-workspace-modal/index.tsx +++ b/apps/core/src/components/affine/create-workspace-modal/index.tsx @@ -10,6 +10,10 @@ import { DebugLogger } from '@affine/debug'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; import { HelpIcon } from '@blocksuite/icons'; import { Button } from '@toeverything/components/button'; +import type { + LoadDBFileResult, + SelectDBFileLocationResult, +} from '@toeverything/infra/type'; import { useSetAtom } from 'jotai'; import type { KeyboardEvent } from 'react'; import { useEffect } from 'react'; @@ -134,7 +138,8 @@ const SetDBLocationContent = ({ } setOpening(true); (async function () { - const result = await window.apis?.dialog.selectDBFileLocation(); + const result: SelectDBFileLocationResult = + await window.apis?.dialog.selectDBFileLocation(); setOpening(false); if (result?.filePath) { onConfirmLocation(result.filePath); @@ -266,7 +271,7 @@ export const CreateWorkspaceModal = ({ } logger.info('load db file'); setStep(undefined); - const result = await window.apis.dialog.loadDBFile(); + const result: LoadDBFileResult = await window.apis.dialog.loadDBFile(); if (result.workspaceId && !canceled) { setAddedId(result.workspaceId); setStep('set-syncing-mode'); diff --git a/apps/core/src/components/affine/new-workspace-setting-detail/export.tsx b/apps/core/src/components/affine/new-workspace-setting-detail/export.tsx index 2453b60b22..12bc7cac56 100644 --- a/apps/core/src/components/affine/new-workspace-setting-detail/export.tsx +++ b/apps/core/src/components/affine/new-workspace-setting-detail/export.tsx @@ -3,6 +3,7 @@ import { SettingRow } from '@affine/component/setting-components'; import { isDesktop } from '@affine/env/constant'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; import { Button } from '@toeverything/components/button'; +import type { SaveDBFileResult } from '@toeverything/infra/type'; import { useCallback } from 'react'; import type { AffineOfficialWorkspace } from '../../../shared'; @@ -37,7 +38,9 @@ export const ExportPanel = ({ workspace }: ExportPanelProps) => { const t = useAFFiNEI18N(); const onExport = useCallback(async () => { await syncBlobsToSqliteDb(workspace); - const result = await window.apis?.dialog.saveDBFileAs(workspaceId); + const result: SaveDBFileResult = await window.apis?.dialog.saveDBFileAs( + workspaceId + ); if (result?.error) { toast(t[result.error]()); } else if (!result?.canceled) { diff --git a/apps/core/src/components/affine/new-workspace-setting-detail/storage.tsx b/apps/core/src/components/affine/new-workspace-setting-detail/storage.tsx index 0bd66838ed..9615902402 100644 --- a/apps/core/src/components/affine/new-workspace-setting-detail/storage.tsx +++ b/apps/core/src/components/affine/new-workspace-setting-detail/storage.tsx @@ -2,6 +2,7 @@ import { FlexWrapper, toast, Tooltip } from '@affine/component'; import { SettingRow } from '@affine/component/setting-components'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; import { Button } from '@toeverything/components/button'; +import type { MoveDBFileResult } from '@toeverything/infra/type'; import { useMemo } from 'react'; import { useCallback, useEffect, useState } from 'react'; @@ -54,7 +55,7 @@ export const StoragePanel = ({ workspace }: StoragePanelProps) => { setMoveToInProgress(true); window.apis?.dialog .moveDBFile(workspaceId) - .then(result => { + .then((result: MoveDBFileResult) => { if (!result?.error && !result?.canceled) { toast(t['Move folder success']()); } else if (result?.error) { diff --git a/package.json b/package.json index 1c8dbd79dd..3ffc8deadc 100644 --- a/package.json +++ b/package.json @@ -71,6 +71,7 @@ "@taplo/cli": "^0.5.2", "@testing-library/react": "^14.0.0", "@toeverything/infra": "workspace:*", + "@types/affine__env": "workspace:*", "@types/eslint": "^8.44.2", "@types/node": "^18.17.1", "@typescript-eslint/eslint-plugin": "^6.2.1", diff --git a/tsconfig.json b/tsconfig.json index 648c425736..5d3e818486 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -21,8 +21,6 @@ "module": "ESNext", "moduleResolution": "bundler", "resolveJsonModule": true, - "types": ["affine__env"], - "typeRoots": ["./node_modules/@types"], // Emit "declaration": true, diff --git a/yarn.lock b/yarn.lock index 394abd2216..a8486bed94 100644 --- a/yarn.lock +++ b/yarn.lock @@ -480,6 +480,7 @@ __metadata: "@taplo/cli": ^0.5.2 "@testing-library/react": ^14.0.0 "@toeverything/infra": "workspace:*" + "@types/affine__env": "workspace:*" "@types/eslint": ^8.44.2 "@types/node": ^18.17.1 "@typescript-eslint/eslint-plugin": ^6.2.1 @@ -11392,7 +11393,7 @@ __metadata: languageName: node linkType: hard -"@types/affine__env@workspace:packages/@types/env": +"@types/affine__env@workspace:*, @types/affine__env@workspace:packages/@types/env": version: 0.0.0-use.local resolution: "@types/affine__env@workspace:packages/@types/env" dependencies: