Skip to content

fix: prevent deepStrictAssert crash on non-leaf object keys#42

Merged
kakasoo merged 1 commit intomainfrom
kakasoo/deep-flat-type
Feb 20, 2026
Merged

fix: prevent deepStrictAssert crash on non-leaf object keys#42
kakasoo merged 1 commit intomainfrom
kakasoo/deep-flat-type

Conversation

@kakasoo
Copy link
Owner

@kakasoo kakasoo commented Feb 20, 2026

Summary

Fix a crash in deepStrictAssert when accessing non-leaf object keys (e.g., 'user' in a deeply nested structure). Added rest.length > 0 guard before recursing into nested objects, consistent with the existing fix in deepStrictPick.

Closes #19

Changes

  • Add guard condition to prevent recursive traversal with empty keys array
  • Add regression test for non-leaf object key access

Test Status

All 380 tests passing, including new test for non-leaf object key access.

Add `rest.length > 0` guard before recursing into nested objects,
consistent with the existing fix in `deepStrictPick`. Closes #19.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@kakasoo kakasoo merged commit 3dd721a 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.

[BUG] deepStrictAssert crashes when accessing non-leaf object keys

1 participant