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 exported type, resolve "is not a module" error in ts #559

Merged
merged 2 commits into from Apr 13, 2023

Conversation

Codex-
Copy link
Contributor

@Codex- Codex- commented Feb 3, 2023

What

Update the interface for matches to extend a record to provide the index string signature expected by expect.extend, matches what the @testing-library types do: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/testing-library__jest-dom/matchers.d.ts#L1

Why

Fixes the error:

File '/node_modules/jest-extended/types/index.d.ts' is not a module.ts(2306)

Issue #367 was closed without addressing this problem, instead, the PR made that was used to close the issue describes a workaround. This workaround is not so suitable for other test suites consuming these matchers, like vitest without globals.

Fixes #367

Currently, this documentation errors with typescript, this fixes it and improves support.

Notes

import * as matchers from 'jest-extended'
import { expect } from 'vitest'

matchers.fail // you can see all of the expected matchers provided by this package

expect.extend(matchers)

expect(1).pass("") // shows that using the existing type extensions, the new methods are still attached as expected

Housekeeping

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

@Codex- Codex- changed the title Fix exported type Fix exported type, resolve "is not a module" error in ts Feb 3, 2023
@changeset-bot
Copy link

changeset-bot bot commented Feb 18, 2023

⚠️ No Changeset found

Latest commit: ba34065

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@codecov
Copy link

codecov bot commented Feb 18, 2023

Codecov Report

Merging #559 (0d6255d) into main (77f8aca) will not change coverage.
The diff coverage is n/a.

❗ Current head 0d6255d differs from pull request most recent head ba34065. Consider uploading reports for the commit ba34065 to get more accurate results

@@            Coverage Diff            @@
##              main      #559   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           73        73           
  Lines          674       673    -1     
  Branches       290       289    -1     
=========================================
- Hits           674       673    -1     

see 1 file with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@Codex-
Copy link
Contributor Author

Codex- commented Mar 16, 2023

Hey @SimenB is there anything I can do to get some eyes on this? :)

@Codex-
Copy link
Contributor Author

Codex- commented Apr 11, 2023

@keeganwitt sorry to bother, would it be possible to have this looked at by yourself or a member of the team?

@keeganwitt
Copy link
Collaborator

I'm not sure if there's anything else we need in the module you added. But this does seem to fix the issue. Thank you!

@keeganwitt keeganwitt merged commit 18680e8 into jest-community:main Apr 13, 2023
19 checks passed
@Codex- Codex- deleted the fix_exported_type branch April 13, 2023 21:29
@Codex-
Copy link
Contributor Author

Codex- commented Apr 13, 2023

Thanks @keeganwitt , really appreciate it! :)

@ooloth
Copy link

ooloth commented Jun 5, 2023

Any chance this change could be released soon? It would be handy.

@keeganwitt
Copy link
Collaborator

We are working on a release now (#605).

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.

Typescript error when importing jest-extended
3 participants