refactor(server): remove redundant null from unknown union types (#693)

This commit is contained in:
Mohamed Boudra
2026-05-05 19:56:52 +07:00
parent 936deaa869
commit cccccca18e
7 changed files with 11 additions and 11 deletions
@@ -6,8 +6,8 @@ function toolCallItem(params: {
callId: string; callId: string;
name: string; name: string;
status?: "running" | "completed" | "failed" | "canceled"; status?: "running" | "completed" | "failed" | "canceled";
input?: unknown | null; input?: unknown;
output?: unknown | null; output?: unknown;
error?: unknown; error?: unknown;
metadata?: Record<string, unknown>; metadata?: Record<string, unknown>;
detail?: Extract<AgentTimelineItem, { type: "tool_call" }>["detail"]; detail?: Extract<AgentTimelineItem, { type: "tool_call" }>["detail"];
@@ -255,8 +255,8 @@ export type ToolCallDetail =
} }
| { | {
type: "unknown"; type: "unknown";
input: unknown | null; input: unknown;
output: unknown | null; output: unknown;
}; };
interface ToolCallBase { interface ToolCallBase {
@@ -136,7 +136,7 @@ function getLatestCompletedBashCall(events: AgentStreamEvent[]): ToolCallTimelin
} }
function getInternalQuery(session: AgentSession): unknown { function getInternalQuery(session: AgentSession): unknown {
return (session as AgentSession & { query?: unknown | null }).query ?? null; return (session as AgentSession & { query?: unknown }).query ?? null;
} }
async function createSession(params?: { async function createSession(params?: {
@@ -100,7 +100,7 @@ function resolveDetailName(toolKind: ClaudeToolKind, name: string): string {
function mapClaudeToolCall( function mapClaudeToolCall(
params: MapperParams, params: MapperParams,
status: ClaudeToolCallStatus, status: ClaudeToolCallStatus,
error: unknown | null, error: unknown,
): ToolCallTimelineItem | null { ): ToolCallTimelineItem | null {
const parsed = ClaudeRawToolCallSchema.safeParse({ ...params, status, error }); const parsed = ClaudeRawToolCallSchema.safeParse({ ...params, status, error });
if (!parsed.success) { if (!parsed.success) {
@@ -31,10 +31,10 @@ const CodexRolloutToolCallParamsSchema = z
interface CodexNormalizedToolCallEnvelope { interface CodexNormalizedToolCallEnvelope {
callId: string; callId: string;
name: string; name: string;
input?: unknown | null; input?: unknown;
output?: unknown | null; output?: unknown;
status?: ToolCallTimelineItem["status"]; status?: ToolCallTimelineItem["status"];
error?: unknown | null; error?: unknown;
metadata?: Record<string, unknown>; metadata?: Record<string, unknown>;
cwd?: string | null; cwd?: string | null;
} }
@@ -201,7 +201,7 @@ interface PiLsToolCall {
interface PiUnknownToolCall { interface PiUnknownToolCall {
kind: "unknown"; kind: "unknown";
toolName: string; toolName: string;
args: unknown | null; args: unknown;
} }
type PiTrackedToolCall = type PiTrackedToolCall =
@@ -46,7 +46,7 @@ export function statPaseoConfigPath(repoRoot: string): PaseoConfigRevision | nul
}; };
} }
export function readPaseoConfigJson(repoRoot: string): unknown | null { export function readPaseoConfigJson(repoRoot: string): unknown {
const configPath = resolvePaseoConfigPath(repoRoot); const configPath = resolvePaseoConfigPath(repoRoot);
if (!existsSync(configPath)) { if (!existsSync(configPath)) {
return null; return null;