Skip to content

fix: prevent deepStrictObjectKeys from recursing into Date objects#46

Merged
kakasoo merged 1 commit intomainfrom
kakasoo/fix-date-recursion
Feb 20, 2026
Merged

fix: prevent deepStrictObjectKeys from recursing into Date objects#46
kakasoo merged 1 commit intomainfrom
kakasoo/fix-date-recursion

Conversation

@kakasoo
Copy link
Owner

@kakasoo kakasoo commented Feb 20, 2026

Summary

Fixed a type/runtime mismatch in deepStrictObjectKeys where the runtime function was incorrectly recursing into Date objects, producing keys like "createdAt.toISOString" and "createdAt.getTime". The type-level implementation correctly treats Date as a leaf value (via the ValueType type), but the runtime function lacked this guard.

Changes

  • Added instanceof Date check to the object recursion condition in deepStrictObjectKeys
  • Added 3 comprehensive test cases covering nested Date objects, Date in array elements, and multiple Date fields at different depths
  • All 388 tests pass (385 existing + 3 new)

Closes

#39

🤖 Generated with Claude Code

Date objects are leaf values in the object tree (via ValueType), but the
runtime function was treating them as regular objects to traverse, producing
keys like "createdAt.toISOString" and "createdAt.getTime". This created a
type/runtime mismatch where the type-level DeepStrictObjectKeys correctly
treated Date as a leaf, but the runtime function did not.

Added instanceof Date guard alongside the existing object type check to
ensure consistent behavior with the type-level implementation.

Test coverage added for:
- Date as nested leaf inside objects
- Date properties inside array elements
- Multiple Date fields at different nesting depths

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
@kakasoo kakasoo merged commit afa59fb into main Feb 20, 2026
1 check passed
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.

1 participant