Skip to content

Fix TypeScript error in isEqual initialization#517

Merged
erikras merged 1 commit into
mainfrom
fix-isEqual-typescript
Feb 11, 2026
Merged

Fix TypeScript error in isEqual initialization#517
erikras merged 1 commit into
mainfrom
fix-isEqual-typescript

Conversation

@erikras-richard-agent

@erikras-richard-agent erikras-richard-agent commented Feb 10, 2026

Copy link
Copy Markdown
Contributor

Problem

PR #480 introduced a TypeScript compilation error:

error TS2339: Property 'isEqual' does not exist on type...

This is breaking CI on all PRs because the prepare hook runs TypeScript compilation.

Root Cause

The field object literal was missing the isEqual property in its initial definition (line 878-895), but it was being assigned later (line 902-905). TypeScript couldn't narrow the union type properly.

Fix

Add isEqual: tripleEquals to the initial field object literal to match the InternalFieldState type.

Verification

npx tsc --noEmit now passes with no errors

Urgency

🔥 Blocking - This breaks CI for all new PRs including #516 (size-limit migration)

Summary by CodeRabbit

  • Bug Fixes
    • Improved consistency of form field comparisons to ensure all fields operate with standardized behavior.

The field object literal was missing the isEqual property in its
initial definition, causing TypeScript to fail when it was assigned later.

Add isEqual: tripleEquals to the initial field object to match the
InternalFieldState type.

Fixes TypeScript compilation broken by #480.
@coderabbitai

coderabbitai Bot commented Feb 10, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

A default equality comparator function (tripleEquals) is assigned to the field object during field registration in registerField. This ensures every newly created field has a concrete equality function by default instead of potentially being undefined.

Changes

Cohort / File(s) Summary
Field Initialization
src/FinalForm.ts
Added default isEqual: tripleEquals assignment to field object creation in registerField to ensure all fields have a concrete equality comparator.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

🐰 Fields now know their worth,
With equality's gentle touch,
Triple equals keeps them true,
No more wondering, no more fuss—
Every field now stands its ground! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding a default isEqual function to fix a TypeScript compilation error in the field initialization.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-isEqual-typescript

No actionable comments were generated in the recent review. 🎉


Comment @coderabbitai help to get the list of available commands and usage tips.

@erikras
erikras merged commit ec4de30 into main Feb 11, 2026
4 checks passed
erikras-dinesh-agent pushed a commit to erikras-gilfoyle-agent/final-form that referenced this pull request Feb 11, 2026
Integrated upstream changes:
- PR final-form#480: Improved isEqual register initialization
- PR final-form#517: Fixed TypeScript isEqual errors

Preserved async validation tracking:
- instanceId for stable field instance tracking
- asyncValidationCount and asyncValidationKey

The merge keeps the upstream's robust isEqual initialization logic
while maintaining the per-field async validation tracking needed
to prevent race conditions.
@erikras-richard-agent

Copy link
Copy Markdown
Contributor Author

Published in v5.0.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants