fix(*): Web 构建 - 修复短剧项目空间合并后的 TypeScript 类型错误

This commit is contained in:
ddCat
2026-07-27 11:14:16 +08:00
parent 5d1a19fdf4
commit 87f3576df2
15 changed files with 63 additions and 55 deletions

View File

@@ -179,7 +179,7 @@ function MediaAssetCard({ asset, personalAsset, onCategoryChange, onVersion, onR
}
function characterDefinition(values: CharacterForm) {
const definition = Object.fromEntries(characterFields.map(([key]) => [key, values[key]?.trim() || (key === "aliases" ? [] : "")]));
const definition: Record<string, unknown> = Object.fromEntries(characterFields.map(([key]) => [key, values[key]?.trim() || (key === "aliases" ? [] : "")]));
definition.aliases = values.aliases?.split(/[,,]/).map((item) => item.trim()).filter(Boolean) || [];
return definition;
}

View File

@@ -8,7 +8,7 @@ import Highlight from "@tiptap/extension-highlight";
import Placeholder from "@tiptap/extension-placeholder";
import TextAlign from "@tiptap/extension-text-align";
import { TextStyle } from "@tiptap/extension-text-style";
import { EditorContent, useEditor } from "@tiptap/react";
import { EditorContent, useEditor, type Editor } from "@tiptap/react";
import StarterKit from "@tiptap/starter-kit";
import {
AlignCenter,
@@ -425,7 +425,7 @@ export default function ProjectChaptersView({ detail, refreshProject }: ProjectD
);
}
function EditorToolbar({ editor }: { editor: ReturnType<typeof useEditor> }) {
function EditorToolbar({ editor }: { editor: Editor | null }) {
const setLink = () => {
if (!editor) return;
const current = String(editor.getAttributes("link").href || "");
@@ -472,7 +472,7 @@ function EditorToolbar({ editor }: { editor: ReturnType<typeof useEditor> }) {
);
}
function EditorTool({ editor, label, icon, active = false, onClick }: { editor: ReturnType<typeof useEditor>; label: string; icon: ReactNode; active?: boolean; onClick: () => void }) {
function EditorTool({ editor, label, icon, active = false, onClick }: { editor: Editor | null; label: string; icon: ReactNode; active?: boolean; onClick: () => void }) {
return <Tooltip title={label}><button type="button" aria-label={label} className={`grid size-7 shrink-0 place-items-center rounded ${active ? "bg-foreground/[.08] text-[var(--workspace-accent)]" : "text-foreground/55 hover:bg-foreground/[.06] hover:text-foreground"}`} disabled={!editor} onClick={onClick}>{icon}</button></Tooltip>;
}