Skip to content

feat: add glob (*) pattern to DeepStrictObjectKeys#27

Merged
kakasoo merged 4 commits intomainfrom
kakasoo/fix-deep-strict-pick
Feb 19, 2026
Merged

feat: add glob (*) pattern to DeepStrictObjectKeys#27
kakasoo merged 4 commits intomainfrom
kakasoo/fix-deep-strict-pick

Conversation

@kakasoo
Copy link
Owner

@kakasoo kakasoo commented Feb 19, 2026

Summary

  • Add * (glob/wildcard) pattern to DeepStrictObjectKeys enabling patterns like '*', 'a.*', 'items[*].*' for wildcard key selection
  • Create ExpandGlob helper type to convert glob patterns into template literal matchers
  • Update DeepStrictPick and DeepStrictOmit to handle glob patterns correctly (Pick<T, '*'> returns T, Omit<T, '*'> returns {})

Changes

  • src/types/DeepStrictObjectKeys.ts — Append | '*' to Infer output with empty-object guard
  • src/types/ExpandGlob.ts — New helper type for expanding glob patterns
  • src/types/DeepStrictPick.ts — Add '*' extends K ? T short-circuit + ExpandGlob<K> + double Exclude to filter glob from omit set
  • src/types/DeepStrictOmit.ts — Add '*' extends K ? {} at both entry and Infer level
  • src/functions/DeepStrictObjectKeys.ts — Add WithoutGlob to exclude glob patterns from runtime return type
  • Tests — 12 new glob-specific tests across ObjectKeys, Pick, and Omit; all 311 tests pass

Test plan

  • All 311 existing + new tests pass (npm run build:test && npm run test)
  • Verify DeepStrictPick<T, '*'> returns full T
  • Verify DeepStrictOmit<T, '*'> returns {}
  • Verify DeepStrictPick<T, 'a.*'> returns { a: T['a'] }
  • Verify DeepStrictOmit<T, 'a.*'> returns { a: {}; ...rest }
  • Verify runtime deepStrictObjectKeys return type excludes '*' patterns

Closes #2

🤖 Generated with Claude Code

kakasoo and others added 3 commits February 19, 2026 22:56
…election

Add `*` pattern support to DeepStrictObjectKeys, enabling wildcard key
selection at any nesting level (e.g., `'*'`, `'a.*'`, `'items[*].*'`).
DeepStrictPick and DeepStrictOmit handle glob patterns correctly.

Closes #2

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…formatting

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@kakasoo kakasoo self-assigned this Feb 19, 2026
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@kakasoo kakasoo merged commit b641ada into main Feb 19, 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.

[Discussion] Add another pattern as a result of DeepStrictObjectKeys

1 participant