Skip to content

Comments

fix: resolve TypeScript type errors for nullable fields (CI auto-fix for PR #370)#373

Closed
github-actions[bot] wants to merge 1 commit intodevfrom
claude-fix-pr-370-20366261694
Closed

fix: resolve TypeScript type errors for nullable fields (CI auto-fix for PR #370)#373
github-actions[bot] wants to merge 1 commit intodevfrom
claude-fix-pr-370-20366261694

Conversation

@github-actions
Copy link
Contributor

CI Auto-Fix

Original PR: #370
Failed CI Run: Non-Main Branch CI/CD

Root Cause

Recent commit caa6c01 added batch update support for daily limit fields to avoid race conditions. The code changed from:

// Before: Multiple sequential calls
emitChange("dailyQuota", null);
emitChange("dailyResetMode", "fixed");
emitChange("dailyResetTime", "00:00");

// After: Single batch call
emitChange({
  dailyQuota: null,
  dailyResetMode: "fixed",
  dailyResetTime: "00:00",
});

However, the onChange/emitChange type signatures weren't updated to support the new batch update pattern.

Fixes Applied

File Fix Type
src/actions/users.ts Add ?? undefined for dailyQuota and other nullable limit fields in createUser/updateUser calls Type safety
src/repository/user.ts Convert null to undefined for string fields that don't accept null Type safety
src/app/.../user-form.tsx Add ?? undefined for dailyQuota in addUser/editUser calls Type safety
src/app/.../key-edit-section.tsx Update onChange prop type to support both single field (field, value) and batch (updates) patterns Type signature
src/app/.../user-edit-section.tsx Update onChange prop type and emitChange function to support batch updates Type signature + implementation
src/app/.../unified-edit-dialog.tsx Update onChange wrapper to pass typed parameters Type safety
src/app/.../limit-rule-picker.tsx Fixed import order (auto-fix by linter) Lint

Verification

  • bun run typecheck passes
  • bun run lint passes
  • No logic changes made - only type signature updates and null-to-undefined conversions

Technical Details

The fix updates the onChange prop type from:

onChange: (field: string, value: any) => void;

To an overloaded signature that supports both patterns:

onChange: {
  (field: string, value: any): void;
  (updates: Record<string, any>): void;
};

This maintains backward compatibility with existing single-field calls while properly supporting the new batch update pattern.


Auto-generated by Claude AI

Fixed:
- src/actions/users.ts: Add ?? undefined for dailyQuota and other nullable limit fields when calling createUser/updateUser
- src/repository/user.ts: Convert null to undefined for string fields that don't accept null
- src/app/.../user-form.tsx: Add ?? undefined for dailyQuota in addUser/editUser calls
- src/app/.../key-edit-section.tsx: Update onChange prop type to support both single field and batch updates
- src/app/.../user-edit-section.tsx: Update onChange prop type and emitChange function to support batch updates
- src/app/.../unified-edit-dialog.tsx: Update onChange wrapper to pass typed parameters
- src/app/.../limit-rule-picker.tsx: Fixed import order (auto-fix by linter)

Root cause: Recent commit (caa6c01) added batch update support for daily limit fields
to avoid race conditions, but the onChange type signatures weren't updated to support
the new pattern of passing an object instead of (field, value) parameters.

CI Run: https://github.com/ding113/claude-code-hub/actions/runs/20366261694

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@ding113 ding113 closed this Dec 19, 2025
@github-project-automation github-project-automation bot moved this from Backlog to Done in Claude Code Hub Roadmap Dec 19, 2025
@ding113 ding113 deleted the claude-fix-pr-370-20366261694 branch December 23, 2025 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant