mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-18 06:15:51 +00:00
feat: 全部类型问题解决
This commit is contained in:
@@ -69,7 +69,7 @@ function convertPluginHooksToMatchers(
|
||||
continue
|
||||
}
|
||||
|
||||
for (const matcher of matchers) {
|
||||
for (const matcher of (matchers ?? [])) {
|
||||
if (matcher.hooks.length > 0) {
|
||||
pluginMatchers[hookEvent].push({
|
||||
matcher: matcher.matcher,
|
||||
@@ -195,7 +195,7 @@ export async function pruneRemovedPluginHooks(): Promise<void> {
|
||||
// clearRegisteredPluginHooks; we only need to re-register survivors.
|
||||
const survivors: Partial<Record<HookEvent, PluginHookMatcher[]>> = {}
|
||||
for (const [event, matchers] of Object.entries(current)) {
|
||||
const kept = matchers.filter(
|
||||
const kept = (matchers ?? []).filter(
|
||||
(m): m is PluginHookMatcher =>
|
||||
'pluginRoot' in m && enabledRoots.has(m.pluginRoot),
|
||||
)
|
||||
|
||||
@@ -259,7 +259,7 @@ export function resolvePluginLspEnvironment(
|
||||
|
||||
// Resolve args
|
||||
if (resolved.args) {
|
||||
resolved.args = resolved.args.map(arg => resolveValue(arg))
|
||||
resolved.args = resolved.args.map((arg: string) => resolveValue(arg))
|
||||
}
|
||||
|
||||
// Resolve environment variables and add CLAUDE_PLUGIN_ROOT / CLAUDE_PLUGIN_DATA
|
||||
|
||||
@@ -81,6 +81,7 @@ import {
|
||||
setPluginSettingsBase,
|
||||
} from '../settings/settingsCache.js'
|
||||
import type { HooksSettings } from '../settings/types.js'
|
||||
import type { HookMatcher } from '../../schemas/hooks.js'
|
||||
import { SettingsSchema } from '../settings/types.js'
|
||||
import { jsonParse, jsonStringify } from '../slowOperations.js'
|
||||
import { getAddDirEnabledPlugins } from './addDirPluginSettings.js'
|
||||
@@ -1861,15 +1862,13 @@ function mergeHooksSettings(
|
||||
|
||||
const merged = { ...base }
|
||||
|
||||
for (const [event, matchers] of Object.entries(additional)) {
|
||||
for (const [event, matchers] of Object.entries(additional) as [string, HookMatcher[]][]) {
|
||||
if (!merged[event as keyof HooksSettings]) {
|
||||
merged[event as keyof HooksSettings] = matchers
|
||||
} else {
|
||||
// Merge matchers for this event
|
||||
merged[event as keyof HooksSettings] = [
|
||||
...(merged[event as keyof HooksSettings] || []),
|
||||
...matchers,
|
||||
]
|
||||
const existing = ((merged[event as keyof HooksSettings] as unknown) ?? []) as HookMatcher[]
|
||||
merged[event as keyof HooksSettings] = [...existing, ...matchers]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user