Skip to content

Fix issue with typings when creating wrapper function#33

Merged
Stinobe merged 3 commits into
mainfrom
bugfix
May 16, 2026
Merged

Fix issue with typings when creating wrapper function#33
Stinobe merged 3 commits into
mainfrom
bugfix

Conversation

@Stinobe

@Stinobe Stinobe commented May 16, 2026

Copy link
Copy Markdown
Owner

I noticed that when creating a wrapper function the types were acting up and only ZodType was working well

Stinobe added 2 commits May 16, 2026 11:20
Found this issue when creating a wrapper function

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adjusts the library’s public TypeScript typings to behave more predictably when consumers create wrapper functions around mattr/parse, and aligns excerpt function typing with actual runtime behavior.

Changes:

  • Allow custom excerpt functions (ExcerptFunction) to return null.
  • Simplify parse and extractExcerpt typings by removing ZodType-specific overload signatures.
  • Add a patch changeset for the release.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
src/types.ts Updates ExcerptFunction return type to string | null to match runtime behavior.
src/parse.ts Removes overload signatures and consolidates parse into a single generic signature.
src/excerpt.ts Removes ZodType overload signatures for extractExcerpt and unused import.
.changeset/soft-experts-boil.md Adds a patch release note for the typing fix.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/parse.ts Outdated
Comment thread src/parse.ts Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@Stinobe Stinobe merged commit be11f46 into main May 16, 2026
1 check passed
@Stinobe Stinobe deleted the bugfix branch May 16, 2026 09:46
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