fix: resolve pre-existing TypeScript build errors

- Accept string | null in typeColors functions (matches VaultEntry.isA type)
- Add missing snippet/relationships fields to test mock entries
- Remove unused imports (AIChatPanel in App, cn in Editor)
- Fix Promise type cast in Editor.tsx tryParseMarkdownToBlocks
- Fix null coalescing in Inspector resolveRefType return
- Remove unused container variable in NoteList test

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
lucaronin
2026-02-20 23:49:22 +01:00
parent 8a468709f0
commit 6fd145702e
7 changed files with 29 additions and 8 deletions

View File

@@ -47,6 +47,8 @@ const mockEntry: VaultEntry = {
modifiedAt: 1700000000,
createdAt: null,
fileSize: 1024,
snippet: '',
relationships: {},
}
const mockContent = `---

View File

@@ -12,7 +12,6 @@ import { ResizeHandle } from './ResizeHandle'
import { TabBar } from './TabBar'
import { BreadcrumbBar } from './BreadcrumbBar'
import { useEditorTheme } from '../hooks/useTheme'
import { cn } from '@/lib/utils'
import { splitFrontmatter, preProcessWikilinks, injectWikilinks, countWords } from '../utils/wikilinks'
import './Editor.css'
import './EditorTheme.css'
@@ -235,7 +234,7 @@ export const Editor = memo(function Editor({
applyBlocks(withWikilinks)
}
if (result && typeof (result as any).then === 'function') {
(result as Promise<any[]>).then(handleBlocks)
(result as unknown as Promise<any[]>).then(handleBlocks)
} else {
handleBlocks(result as any[])
}

View File

@@ -17,6 +17,8 @@ const mockEntry: VaultEntry = {
modifiedAt: 1707900000,
createdAt: null,
fileSize: 1024,
snippet: '',
relationships: {},
}
const mockContent = `---
@@ -50,6 +52,8 @@ const referrerEntry: VaultEntry = {
modifiedAt: 1707900000,
createdAt: null,
fileSize: 200,
snippet: '',
relationships: {},
}
const allContent: Record<string, string> = {

View File

@@ -70,7 +70,7 @@ function resolveRefType(ref: string, entries: VaultEntry[]): string | undefined
if (fileStem === target.split('/').pop()) return true
return false
})
return match?.isA
return match?.isA ?? undefined
}
function RelationshipGroup({ label, refs, entries, onNavigate }: { label: string; refs: string[]; entries: VaultEntry[]; onNavigate: (target: string) => void }) {

View File

@@ -131,7 +131,7 @@ describe('NoteList', () => {
})
it('shows entity pinned at top with grouped children', () => {
const { container } = render(
render(
<NoteList entries={mockEntries} selection={{ kind: 'entity', entry: mockEntries[0] }} selectedNote={null} onSelectNote={noopSelect} allContent={{}} onCreateNote={vi.fn()} />
)
// Entity title appears in header and pinned card

View File

@@ -18,6 +18,8 @@ const mockEntries: VaultEntry[] = [
modifiedAt: 1700000000,
createdAt: null,
fileSize: 1024,
snippet: '',
relationships: {},
},
{
path: '/vault/responsibility/grow-newsletter.md',
@@ -33,6 +35,8 @@ const mockEntries: VaultEntry[] = [
modifiedAt: 1700000000,
createdAt: null,
fileSize: 512,
snippet: '',
relationships: {},
},
{
path: '/vault/experiment/stock-screener.md',
@@ -48,6 +52,8 @@ const mockEntries: VaultEntry[] = [
modifiedAt: 1700000000,
createdAt: null,
fileSize: 256,
snippet: '',
relationships: {},
},
{
path: '/vault/procedure/weekly-essays.md',
@@ -63,6 +69,8 @@ const mockEntries: VaultEntry[] = [
modifiedAt: 1700000000,
createdAt: null,
fileSize: 128,
snippet: '',
relationships: {},
},
{
path: '/vault/topic/software-development.md',
@@ -78,6 +86,8 @@ const mockEntries: VaultEntry[] = [
modifiedAt: 1700000000,
createdAt: null,
fileSize: 256,
snippet: '',
relationships: {},
},
{
path: '/vault/topic/trading.md',
@@ -93,6 +103,8 @@ const mockEntries: VaultEntry[] = [
modifiedAt: 1700000000,
createdAt: null,
fileSize: 180,
snippet: '',
relationships: {},
},
{
path: '/vault/person/alice.md',
@@ -108,6 +120,8 @@ const mockEntries: VaultEntry[] = [
modifiedAt: 1700000000,
createdAt: null,
fileSize: 100,
snippet: '',
relationships: {},
},
{
path: '/vault/event/kickoff.md',
@@ -123,6 +137,8 @@ const mockEntries: VaultEntry[] = [
modifiedAt: 1700000000,
createdAt: null,
fileSize: 200,
snippet: '',
relationships: {},
},
]