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:
LongYinan
2023-05-31 20:49:56 +08:00
committed by GitHub
parent 78410f531a
commit 1ea445ab15
81 changed files with 434 additions and 241 deletions

View File

@@ -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);

View File

@@ -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: {

View File

@@ -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',