From 2d5a0060e23254d7877681a6f399e8550304d816 Mon Sep 17 00:00:00 2001 From: Shinji-Li <1349021570@qq.com> Date: Fri, 24 Nov 2023 17:42:30 +0800 Subject: [PATCH] :green_heart: ci: ci ts error fixed (#104) * :green_heart: fix: ci ts error fixed * :green_heart: fix: delete useless types tsconfig --- src/Markdown/index.tsx | 3 ++- src/ProBuilder/store/slices/config.ts | 5 ++++- src/ProBuilder/utils/yjs.ts | 6 +++--- src/ProEditor/ProEditorProvider/index.test.tsx | 2 -- src/ProEditor/store/slices/config.ts | 2 +- src/ProEditor/utils/yjs.ts | 6 +++--- tsconfig.json | 2 +- 7 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/Markdown/index.tsx b/src/Markdown/index.tsx index fa631748..25fdf72c 100644 --- a/src/Markdown/index.tsx +++ b/src/Markdown/index.tsx @@ -6,6 +6,7 @@ import remarkGfm from 'remark-gfm'; import remarkMath from 'remark-math'; import { HighlightProps, SnippetProps } from '@ant-design/pro-editor'; +import { PluggableList } from 'react-markdown/lib/react-markdown'; import { Code } from './CodeBlock'; import { useStyles } from './style'; @@ -47,7 +48,7 @@ const Markdown = memo( diff --git a/src/ProBuilder/store/slices/config.ts b/src/ProBuilder/store/slices/config.ts index ecbaf573..b36eb904 100644 --- a/src/ProBuilder/store/slices/config.ts +++ b/src/ProBuilder/store/slices/config.ts @@ -140,7 +140,10 @@ export const configSlice: StateCreator< replace, ); - const useAction = merge({}, { recordHistory: true }, { recordHistory }); + const useAction: { + recordHistory: boolean; + payload?: Partial; + } = merge({}, { recordHistory: true }, { recordHistory }); if (useAction.recordHistory) { get().yjsDoc.recordHistoryData({ config }, { ...useAction.payload, timestamp: Date.now() }); diff --git a/src/ProBuilder/utils/yjs.ts b/src/ProBuilder/utils/yjs.ts index 44304831..3fd54b79 100644 --- a/src/ProBuilder/utils/yjs.ts +++ b/src/ProBuilder/utils/yjs.ts @@ -2,9 +2,9 @@ import { Doc, UndoManager } from 'yjs'; import { DocOpts } from 'yjs/dist/src/utils/Doc'; export interface UserActionParams { - type: string; - name: string; - timestamp: number; + type?: string; + name?: string; + timestamp?: number; } class UserAction { diff --git a/src/ProEditor/ProEditorProvider/index.test.tsx b/src/ProEditor/ProEditorProvider/index.test.tsx index c1d40195..e62e620c 100644 --- a/src/ProEditor/ProEditorProvider/index.test.tsx +++ b/src/ProEditor/ProEditorProvider/index.test.tsx @@ -1,5 +1,4 @@ import { ProEditorProvider, proEditorMiddleware } from '@ant-design/pro-editor'; - import { render, renderHook, screen } from '@testing-library/react'; import { create } from 'zustand'; @@ -22,7 +21,6 @@ describe('ProEditorProvider', () => {
Child Component
, ); - expect(screen.getByText('Child Component')).toBeInTheDocument(); }); diff --git a/src/ProEditor/store/slices/config.ts b/src/ProEditor/store/slices/config.ts index c63af67f..a9977dab 100644 --- a/src/ProEditor/store/slices/config.ts +++ b/src/ProEditor/store/slices/config.ts @@ -42,7 +42,7 @@ export interface ActionOptions { recordHistory?: boolean; replace?: boolean; trigger?: string; - type?: unknown; + type?: unknown | string; name?: string; } diff --git a/src/ProEditor/utils/yjs.ts b/src/ProEditor/utils/yjs.ts index f046c58b..1a61dfed 100644 --- a/src/ProEditor/utils/yjs.ts +++ b/src/ProEditor/utils/yjs.ts @@ -6,9 +6,9 @@ import { StackItem } from 'yjs/dist/src/utils/UndoManager'; import { YEvent } from 'yjs/dist/src/utils/YEvent'; export interface UserActionParams { - type: string; - name: string; - timestamp: number; + type?: string | unknown; + name?: string; + timestamp?: number; } class UserAction { diff --git a/tsconfig.json b/tsconfig.json index 817e83bb..1bb7fa6c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -8,7 +8,7 @@ "target": "ESNext", "module": "esnext", "jsx": "react-jsx", - "types": ["vitest/globals"], + "types": ["vitest/globals", "@testing-library/jest-dom"], "declaration": true, "baseUrl": ".", "paths": {