feat: 全部类型问题解决

This commit is contained in:
claude-code-best
2026-04-11 10:24:00 +08:00
parent 7088fe3c8b
commit 6a70056910
135 changed files with 671 additions and 503 deletions

View File

@@ -117,7 +117,7 @@ export function createApiQueryHook<TResult>(
type: 'success',
queryName: config.name,
result,
messageId: response.message.id,
messageId: response.message.id ?? '',
model,
uuid,
},

View File

@@ -327,7 +327,7 @@ export function groupHooksByEventAndMatcher(
const eventGroup = grouped[hookEvent]
if (!eventGroup) continue
for (const matcher of matchers) {
for (const matcher of (matchers ?? [])) {
const matcherKey = matcher.matcher || ''
// Only PluginHookMatcher has pluginRoot; HookCallbackMatcher (internal

View File

@@ -41,10 +41,10 @@ function formatRecentMessages(messages: Message[]): string {
.filter(m => m.type === 'user' || m.type === 'assistant')
.map(m => {
const role = m.type === 'user' ? 'User' : 'Assistant'
const content = m.message.content
const content = m.message!.content
if (typeof content === 'string')
return `${role}: ${content.slice(0, 500)}`
const text = content
const text = (content ?? [])
.filter(
(b): b is Extract<typeof b, { type: 'text' }> => b.type === 'text',
)