Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: export CustomMatchers interface for declartion merging #653

Closed
wants to merge 5 commits into from

Conversation

cdierkens
Copy link
Contributor

What

export CustomMatchers interface for declartion merging

Why

#652

Housekeeping

  • Unit tests
  • Documentation is up to date
  • No additional lint warnings
  • Typescript definitions are added/updated where relevant

@changeset-bot
Copy link

changeset-bot bot commented Sep 22, 2023

🦋 Changeset detected

Latest commit: f04281f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
jest-extended Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@codecov
Copy link

codecov bot commented Sep 23, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (5294d0e) 100.00% compared to head (f04281f) 100.00%.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #653   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           73        73           
  Lines          674       674           
  Branches       290       290           
=========================================
  Hits           674       674           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@SimenB SimenB left a comment

Choose a reason for hiding this comment

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

thanks!

@SimenB
Copy link
Member

SimenB commented Sep 23, 2023

Huh, unsure why this change breaks the typecheck 🤔

@cdierkens
Copy link
Contributor Author

Huh, unsure why this change breaks the typecheck 🤔

@SimenB I'll try updating the branch. Maybe there's something else I can look into if that doesn't work?

@vercel
Copy link

vercel bot commented Oct 3, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
jest-extended ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 3, 2023 1:55pm

@cdierkens
Copy link
Contributor Author

I'll run the type checking locally and do a bit more research on how other libraries go about declaration merging.

@keeganwitt
Copy link
Collaborator

I tried adding a dependency on @types/jest and adding /// <reference types="jest" />, but that didn't help.

@keeganwitt
Copy link
Collaborator

I'm not sure if this is the right way to fix this, but this way passes the check.

@cdierkens can you confirm whether this still works as a patch for you?

@cdierkens
Copy link
Contributor Author

@keeganwitt I was able to get declaration merging working with the existing types!

import type CustomMatchers from "jest-extended";
import "vitest";

declare module "vitest" {
  interface Assertion<T = any> extends CustomMatchers<T> {}
  interface AsymmetricMatchersContaining<T = any> extends CustomMatchers<T> {}
  interface ExpectStatic extends CustomMatchers<T> {}
}

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.

None yet

3 participants