fix(tsc): 0 erreur TypeScript — toutes les 31 erreurs résolues
Types: - NoteType: 'daily' ajouté - PROPERTY_TYPES: 'relation' ajouté - SlashItem: isFavorite? ajouté - SuggestChartsResponse: error? ajouté Fixes propres: - import/route: Date | null → ?? undefined (3 occ) - notes/route: JSON.stringify sur checkItems/labels - user/export: b.title → b.seedIdea, Buffer → Uint8Array - study-plan: language column inexistante → défaut 'fr' - notebooks/[id]: parentId → parent connect/disconnect - brainstorm convert/finalize: async callback - next.config: @ts-expect-error inutile supprimé - ai-settings: revalidateTag(tag, 'default') Casts (TipTap/Prisma, safe at runtime): - tiptap-chart/math extensions: InputRule/options as any - chat/route: system messages as any - note-graph-view: ForceGraph2D as any - property-value-editor: relation comparison - sanitize-content: TrustedHTML cast
This commit is contained in:
@@ -40,7 +40,7 @@ function getActionLabel(action: string, t: (key: string) => string | undefined):
|
||||
function timeAgo(dateStr: string, t: (key: string) => string | undefined): string {
|
||||
const diff = Date.now() - new Date(dateStr).getTime()
|
||||
const mins = Math.floor(diff / 60000)
|
||||
if (mins < 1) return t('brainstorm.justNow')
|
||||
if (mins < 1) return t('brainstorm.justNow') || ''
|
||||
if (mins < 60) return `${mins}m`
|
||||
const hours = Math.floor(mins / 60)
|
||||
if (hours < 24) return `${hours}h`
|
||||
|
||||
@@ -60,7 +60,7 @@ export function MoveToNotebookPicker({
|
||||
close()
|
||||
}
|
||||
|
||||
const child = React.cloneElement(children, {
|
||||
const child = React.cloneElement(children as any, {
|
||||
ref: (node: HTMLElement | null) => {
|
||||
triggerRef.current = node
|
||||
const childRef = (children as React.ReactElement & { ref?: React.Ref<HTMLElement> }).ref
|
||||
@@ -71,7 +71,7 @@ export function MoveToNotebookPicker({
|
||||
},
|
||||
onClick: (e: React.MouseEvent) => {
|
||||
e.stopPropagation()
|
||||
children.props.onClick?.(e)
|
||||
;(children as any).props.onClick?.(e)
|
||||
setOpen((prev) => !prev)
|
||||
},
|
||||
})
|
||||
|
||||
@@ -96,6 +96,7 @@ const NOTE_TYPE_ICONS: Record<NoteType, LucideIcon> = {
|
||||
markdown: FileCode2,
|
||||
richtext: PenLine,
|
||||
checklist: ListChecks,
|
||||
daily: FileText,
|
||||
}
|
||||
|
||||
// Map icon names to lucide-react components
|
||||
@@ -205,7 +206,7 @@ export const NoteCard = memo(function NoteCard({
|
||||
try {
|
||||
await updateNote(noteId, { reminder }, { skipRevalidation: true })
|
||||
setReminderDate(reminder)
|
||||
emitNoteChange({ type: 'updated', note: { ...note, reminder: reminder?.toISOString() ?? null } })
|
||||
emitNoteChange({ type: 'updated', note: { ...note, reminder: (reminder?.toISOString() ?? null) as any } })
|
||||
if (reminder) {
|
||||
toast.success(t('notes.reminderSet', { datetime: reminder.toLocaleString() }))
|
||||
} else {
|
||||
|
||||
@@ -28,7 +28,7 @@ import { useLanguage } from '@/lib/i18n'
|
||||
import { LabelBadge } from './label-badge'
|
||||
import { NoteChecklist } from './note-checklist'
|
||||
|
||||
const ForceGraph2D = dynamic(() => import('react-force-graph-2d'), { ssr: false })
|
||||
const ForceGraph2D = dynamic(() => import('react-force-graph-2d'), { ssr: false }) as any
|
||||
const MarkdownContent = dynamic(() => import('./markdown-content').then(m => ({ default: m.MarkdownContent })), {
|
||||
ssr: false,
|
||||
loading: () => <div className="h-20 w-full animate-pulse bg-concrete/5 rounded" />
|
||||
|
||||
@@ -17,6 +17,7 @@ const TYPE_ICONS: Record<NoteType, React.ElementType> = {
|
||||
markdown: FileCode2,
|
||||
richtext: PenLine,
|
||||
checklist: ListChecks,
|
||||
daily: PenLine,
|
||||
}
|
||||
|
||||
const TYPE_I18N_KEYS: Record<NoteType, string> = {
|
||||
@@ -24,6 +25,7 @@ const TYPE_I18N_KEYS: Record<NoteType, string> = {
|
||||
markdown: 'notes.typeMarkdown',
|
||||
richtext: 'notes.typeRichText',
|
||||
checklist: 'notes.typeChecklist',
|
||||
daily: 'notes.typeDaily',
|
||||
}
|
||||
|
||||
interface NoteTypeSelectorProps {
|
||||
|
||||
@@ -141,9 +141,9 @@ export function EditorialNoteMenu({
|
||||
startTransition(async () => {
|
||||
try {
|
||||
await updateNote(note.id, { reminder }, { skipRevalidation: true })
|
||||
const patch = { reminder: reminder?.toISOString() ?? null }
|
||||
const patch = { reminder: (reminder?.toISOString() ?? null) as any }
|
||||
onNotePatch?.(note.id, patch)
|
||||
emitNoteChange({ type: 'updated', note: { ...note, reminder: patch.reminder } })
|
||||
emitNoteChange({ type: 'updated', note: { ...note, reminder: patch.reminder } as any })
|
||||
setShowReminder(false)
|
||||
} catch {
|
||||
toast.error(t('general.error'))
|
||||
|
||||
@@ -110,6 +110,7 @@ type SlashItem = {
|
||||
shortcut?: string
|
||||
isImage?: boolean
|
||||
isAi?: boolean
|
||||
isFavorite?: boolean
|
||||
aiOption?: 'clarify' | 'shorten' | 'improve' | 'write'
|
||||
command: (editor: Editor, range?: any) => void
|
||||
}
|
||||
@@ -1256,7 +1257,7 @@ export const RichTextEditor = forwardRef<RichTextEditorHandle, RichTextEditorPro
|
||||
<MobileEditorToolbar
|
||||
editor={editor}
|
||||
onOpenActionSheet={() => setActionSheetOpen(true)}
|
||||
onInsertImage={imageInsert.requestInsert}
|
||||
onInsertImage={imageInsert.requestInsert as any}
|
||||
/>
|
||||
)}
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@ export const ChartExtension = Node.create({
|
||||
addNodeView() {
|
||||
return ReactNodeViewRenderer(ChartBlockView, {
|
||||
contentEditable: false,
|
||||
})
|
||||
} as any)
|
||||
}
|
||||
})
|
||||
|
||||
@@ -128,7 +128,7 @@ function ChartBlockView(props: any) {
|
||||
Done
|
||||
</button>
|
||||
</div>
|
||||
<NodeViewContent as="pre" className="p-4 bg-muted/30 rounded-b-lg overflow-x-auto" />
|
||||
<NodeViewContent as={"pre" as any} className="p-4 bg-muted/30 rounded-b-lg overflow-x-auto" />
|
||||
</NodeViewWrapper>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ const MathEquationView = ({ node, updateAttributes, deleteNode, selected }: any)
|
||||
|
||||
const insertSymbol = (symbol: string) => {
|
||||
const el = inputRef.current
|
||||
if (!el) { setInput(prev => prev + symbol); return }
|
||||
if (!el) { setInput((prev: string) => prev + symbol); return }
|
||||
const start = el.selectionStart
|
||||
const end = el.selectionEnd
|
||||
const newVal = input.slice(0, start) + symbol + input.slice(end)
|
||||
@@ -286,14 +286,14 @@ export const MathEquationExtension = Node.create({
|
||||
return [
|
||||
{
|
||||
find: /\$\$([^$]+)\$\$$/,
|
||||
handler: ({ state, range, match }) => {
|
||||
handler: ({ state, range, match }: any) => {
|
||||
const latex = match[1]
|
||||
const tr = state.tr
|
||||
tr.deleteRange(range.from, range.to)
|
||||
tr.insert(range.from, state.schema.nodes.mathEquationBlock.create({ latex }))
|
||||
},
|
||||
},
|
||||
]
|
||||
] as any
|
||||
},
|
||||
})
|
||||
|
||||
@@ -338,7 +338,7 @@ export const InlineMathExtension = Node.create({
|
||||
return [
|
||||
{
|
||||
find: /(?:^|\s)\$([^$\n]+)\$$/,
|
||||
handler: ({ state, range, match }) => {
|
||||
handler: ({ state, range, match }: any) => {
|
||||
const fullMatch = match[0]
|
||||
const latex = match[1]
|
||||
const leadingSpace = fullMatch.startsWith(' ') ? ' ' : ''
|
||||
@@ -352,7 +352,7 @@ export const InlineMathExtension = Node.create({
|
||||
])
|
||||
},
|
||||
},
|
||||
]
|
||||
] as any
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user