mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-15 05:37:32 +00:00
build: perform TypeCheck for all packages (#2573)
Co-authored-by: himself65 <himself65@outlook.com> Co-authored-by: Peng Xiao <pengxiao@outlook.com>
This commit is contained in:
1
packages/workspace/.gitignore
vendored
Normal file
1
packages/workspace/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
lib
|
||||
@@ -10,7 +10,8 @@
|
||||
"./providers": "./src/providers/index.ts",
|
||||
"./affine/*": "./src/affine/*.ts",
|
||||
"./affine/api": "./src/affine/api/index.ts",
|
||||
"./affine/keck": "./src/affine/keck/index.ts"
|
||||
"./affine/keck": "./src/affine/keck/index.ts",
|
||||
"./affine/shared": "./src/affine/shared.ts"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@blocksuite/blocks": "*",
|
||||
@@ -18,7 +19,6 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@affine-test/fixtures": "workspace:*",
|
||||
"@affine/component": "workspace:*",
|
||||
"@affine/debug": "workspace:*",
|
||||
"@affine/env": "workspace:*",
|
||||
"@toeverything/hooks": "workspace:*",
|
||||
|
||||
@@ -13,7 +13,6 @@ import { assertExists } from '@blocksuite/global/utils';
|
||||
import type { Page, PageMeta } from '@blocksuite/store';
|
||||
import { Workspace } from '@blocksuite/store';
|
||||
import { faker } from '@faker-js/faker';
|
||||
import type {} from '@toeverything/hooks/use-block-suite-page-meta';
|
||||
import { beforeEach, describe, expect, test, vi } from 'vitest';
|
||||
import { WebSocket } from 'ws';
|
||||
import { applyUpdate } from 'yjs';
|
||||
@@ -36,6 +35,12 @@ import {
|
||||
setLoginStorage,
|
||||
} from '../login';
|
||||
|
||||
declare module '@blocksuite/store' {
|
||||
interface PageMeta {
|
||||
isPublic?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
// @ts-expect-error
|
||||
globalThis.WebSocket = WebSocket;
|
||||
|
||||
@@ -110,7 +115,7 @@ beforeEach(async () => {
|
||||
declare global {
|
||||
interface DocumentEventMap {
|
||||
'affine-error': CustomEvent<{
|
||||
code: MessageCode;
|
||||
code: (typeof MessageCode)[keyof typeof MessageCode];
|
||||
}>;
|
||||
}
|
||||
}
|
||||
@@ -165,7 +170,7 @@ describe('api', () => {
|
||||
const listener = vi.fn(
|
||||
(
|
||||
e: CustomEvent<{
|
||||
code: MessageCode;
|
||||
code: (typeof MessageCode)[keyof typeof MessageCode];
|
||||
}>
|
||||
) => {
|
||||
expect(e.detail.code).toBe(MessageCode.loadListFailed);
|
||||
|
||||
@@ -4,9 +4,12 @@ import { z } from 'zod';
|
||||
import { checkLoginStorage } from '../login';
|
||||
|
||||
export class RequestError extends Error {
|
||||
public readonly code: MessageCode;
|
||||
public readonly code: (typeof MessageCode)[keyof typeof MessageCode];
|
||||
|
||||
constructor(code: MessageCode, cause: unknown | null = null) {
|
||||
constructor(
|
||||
code: (typeof MessageCode)[keyof typeof MessageCode],
|
||||
cause: unknown | null = null
|
||||
) {
|
||||
super(Messages[code].message);
|
||||
sendMessage(code);
|
||||
this.code = code;
|
||||
@@ -15,7 +18,7 @@ export class RequestError extends Error {
|
||||
}
|
||||
}
|
||||
|
||||
function sendMessage(code: MessageCode) {
|
||||
function sendMessage(code: (typeof MessageCode)[keyof typeof MessageCode]) {
|
||||
document.dispatchEvent(
|
||||
new CustomEvent('affine-error', {
|
||||
detail: {
|
||||
|
||||
@@ -119,7 +119,7 @@ export const checkLoginStorage = async (
|
||||
return getLoginStorage() as LoginResponse;
|
||||
};
|
||||
|
||||
export const enum SignMethod {
|
||||
export enum SignMethod {
|
||||
Google = 'Google',
|
||||
GitHub = 'GitHub',
|
||||
// Twitter = 'Twitter',
|
||||
|
||||
@@ -11,7 +11,7 @@ import type { Workspace as RemoteWorkspace } from './affine/api';
|
||||
|
||||
export type JotaiStore = ReturnType<typeof createStore>;
|
||||
|
||||
export const enum WorkspaceSubPath {
|
||||
export enum WorkspaceSubPath {
|
||||
ALL = 'all',
|
||||
SETTING = 'setting',
|
||||
TRASH = 'trash',
|
||||
@@ -115,19 +115,19 @@ export interface AffinePublicWorkspace {
|
||||
providers: Provider[];
|
||||
}
|
||||
|
||||
export const enum ReleaseType {
|
||||
export enum ReleaseType {
|
||||
// if workspace is not released yet, we will not show it in the workspace list
|
||||
UNRELEASED = 'unreleased',
|
||||
STABLE = 'stable',
|
||||
}
|
||||
|
||||
export const enum LoadPriority {
|
||||
export enum LoadPriority {
|
||||
HIGH = 1,
|
||||
MEDIUM = 2,
|
||||
LOW = 3,
|
||||
}
|
||||
|
||||
export const enum WorkspaceFlavour {
|
||||
export enum WorkspaceFlavour {
|
||||
/**
|
||||
* AFFiNE Workspace is the workspace
|
||||
* that hosted on the Legacy AFFiNE Cloud Server.
|
||||
|
||||
@@ -1,4 +1,18 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"include": ["./src"]
|
||||
"compilerOptions": {
|
||||
"composite": true,
|
||||
"noEmit": false,
|
||||
"outDir": "lib"
|
||||
},
|
||||
"include": ["./src", "./src/affine/api", "../../apps/electron/layers"],
|
||||
"exclude": ["lib"],
|
||||
"references": [
|
||||
{ "path": "../../tests/fixtures" },
|
||||
{ "path": "../y-indexeddb" },
|
||||
{ "path": "../env" },
|
||||
{ "path": "../debug" },
|
||||
{ "path": "../hooks" },
|
||||
{ "path": "../component" }
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user